@@ -1320,41 +1320,26 @@ you can include the short versions of the modules.
13201320Field Names with Dots/Periods (``.``) and Dollar Signs (``$``)
13211321==============================================================
13221322
1323- MongoDB query language (MQL) generally uses the dot/period character (``.``)
1324- to separate field names in a field path that traverses embedded documents, and
1325- the dollar character (``$``) for operators. It is possible to utilize field
1326- names containing the dot and dollar characters, however it is recommended to
1327- avoid these characters for ease of querying.
1328-
1329- MongoDB 5.0 adds `special operators
1330- <https://mongodb.com/docs/manual/core/dot-dollar-considerations/#std-label-crud-concepts-dot-dollar-considerations>`_
1331- for querying and modifying documents using field names containing dots and
1332- dollars. Previous MongoDB versions do not provide a mechanism for querying
1333- documents on fields whose names contain dots and dollars, though such documents
1334- can be retrieved verbatim (once they are matched using some other strategy).
1335-
1336- Mongoid provides its own DSL for querying MongoDB and, unlike MongoDB 5.0,
1337- Mongoid does not yet provide any facilities for querying documents using
1338- field names containing dots and dollars. It is possible to query such documents
1339- using MQL, but not via most Mongoid DSL methods. Additionally, there is
1340- other code in Mongoid that assumes that the dot (``.``) separates path
1341- components which may misbehave should a document contain a field with dots
1342- in its name.
1343-
1344- Historically, MongoDB drivers prohibited inserting documents with field names
1345- containing dots and dollars, since such documents couldn't be queried via
1346- those field names. This prohibition is now being lifted due to the new
1347- operators introduced with MongoDB 5.0; however, the required changes in the
1348- Ruby driver `have not yet been implemented
1349- <https://jira.mongodb.org/browse/RUBY-2528>`_. By virtue of using the Ruby
1350- driver to interact with the database, this prohibition on inserting documents
1351- with field names containing dots and dollars also applies to Mongoid.
1352- Thus, while both the Ruby driver and Mongoid permit querying documents that
1353- have been inserted using other mechanisms by field names containing dots and
1354- dollars, there is presently no possibility to insert such documents using
1355- either Ruby driver or Mongoid.
1356-
1357- To summarize, field names containing dots and dollars have limited support in
1358- Mongoid, the Ruby MongoDB driver and MongoDB server. Such field names should
1359- only be used when interfacing with software that already uses these names,
1360- and should be avoided for new development.
1323+ Using dots/periods (``.``) in fields names and starting a field name with
1324+ a dollar sign (``$``) is not recommended, as Mongoid provides limited support
1325+ for retrieving and operating on the documents stored in those fields.
1326+
1327+ Both Mongoid and MongoDB query language (MQL) generally use the dot/period
1328+ character (``.``) to separate field names in a field path that traverses
1329+ embedded documents, and words beginning with the dollar sign (``$``) as
1330+ operators. MongoDB provides `limited support
1331+ <https://www.mongodb.com/docs/manual/core/dot-dollar-considerations/#std-label-crud-concepts-dot-dollar-considerations>`_
1332+ for using field names containing dots and starting with the dollar sign
1333+ for interoperability with other software,
1334+ however, due to this support being confined to specific operators
1335+ (e.g. :manual:`getField </reference/operator/aggregation/getField/>`,
1336+ :manual:`setField </reference/operator/aggregation/setField/>`) and
1337+ requiring the usage of the aggregation pipeline for both queries and updates,
1338+ applications should avoid using dots in field names and starting field names
1339+ with the dollar sign if possible.
1340+
1341+ The Ruby driver `currently prohibits
1342+ <https://jira.mongodb.org/browse/RUBY-2528>`_ inserting documents whose
1343+ field names contain dots or begin with the dollar sign. However, if such
1344+ documents are inserted using other software, Mongoid and the Ruby driver
1345+ provide limited support for retrieving and operating on these documents.
0 commit comments