diff --git a/source/applications/design-notes.txt b/source/applications/design-notes.txt index 52567294ac3..bfcaafb9354 100644 --- a/source/applications/design-notes.txt +++ b/source/applications/design-notes.txt @@ -32,7 +32,7 @@ Some operational considerations include: Avoid importing unmodified data directly from a relational database. In general, you will want to "roll up" certain data into richer documents that take advantage of MongoDB's -support for sub-documents and nested arrays. +support for embedded documents and nested arrays. Case Sensitive Strings ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/source/core/2dsphere.txt b/source/core/2dsphere.txt index 82202c94efd..8f3b422af58 100644 --- a/source/core/2dsphere.txt +++ b/source/core/2dsphere.txt @@ -114,7 +114,7 @@ The :ref:`geojson-multipoint`, :ref:`geojson-multilinestring`, :ref:`geojson-geometrycollection` require ``2dsphere`` index version 2. In order to index GeoJSON data, you must store the data in a location -field that you name. The location field contains a subdocument with a +field that you name. The location field contains an embedded document with a ``type`` field specifying the GeoJSON object type and a ``coordinates`` field specifying the object's coordinates. Always store coordinates in ``longitude, latitude`` order. diff --git a/source/core/data-model-design.txt b/source/core/data-model-design.txt index 01dead81d98..273c8d5ada2 100644 --- a/source/core/data-model-design.txt +++ b/source/core/data-model-design.txt @@ -52,8 +52,8 @@ in MongoDB must be smaller than the :limit:`maximum BSON document size To interact with embedded documents, use :term:`dot notation` to "reach into" embedded documents. See :ref:`query for data in arrays -` and :ref:`query data in sub-documents -` for more examples on accessing data in +` and :ref:`query data in embedded documents +` for more examples on accessing data in arrays and embedded documents. .. _data-modeling-referencing: diff --git a/source/core/data-model-operations.txt b/source/core/data-model-operations.txt index ab652f66071..1397cb54368 100644 --- a/source/core/data-model-operations.txt +++ b/source/core/data-model-operations.txt @@ -73,7 +73,7 @@ that provides atomic updates for a single document. .. [#record-atomicity] Document-level atomic operations include all operations within a single MongoDB document record: operations that - affect multiple sub-documents within that single record are still + affect multiple embedded documents within that single record are still atomic. Sharding diff --git a/source/core/data-modeling-introduction.txt b/source/core/data-modeling-introduction.txt index fbbfd30bb9b..aee35b2b322 100644 --- a/source/core/data-modeling-introduction.txt +++ b/source/core/data-modeling-introduction.txt @@ -49,7 +49,7 @@ Embedded Data Embedded documents capture relationships between data by storing related data in a single document structure. MongoDB documents make it -possible to embed document structures as sub-documents in a field or +possible to embed document structures in a field or array within a document. These *denormalized* data models allow applications to retrieve and manipulate related data in a single database operation. @@ -57,7 +57,7 @@ database operation. .. include:: /images/data-model-denormalized.rst See :ref:`data-modeling-embedding` for the strengths and weaknesses of -embedding sub-documents. +embedding documents. .. end-primer-excerpt diff --git a/source/core/document.txt b/source/core/document.txt index 23ee1c95360..f5244ca1cb8 100644 --- a/source/core/document.txt +++ b/source/core/document.txt @@ -186,7 +186,7 @@ Dot Notation .. seealso:: - - :ref:`read-operations-subdocuments` for dot notation examples + - :ref:`read-operations-embedded-documents` for dot notation examples with embedded documents. - :ref:`read-operations-arrays` for dot notation examples with diff --git a/source/core/geospatial-indexes.txt b/source/core/geospatial-indexes.txt index 00c7960a79f..4d347e20e55 100644 --- a/source/core/geospatial-indexes.txt +++ b/source/core/geospatial-indexes.txt @@ -83,8 +83,8 @@ the following: db.places.createIndex( { "locs": "2d" } ) -You may also model the location data as a field inside of a -sub-document. In this case, the document would contain a field +You may also model the location data as a field inside of an +embedded document. In this case, the document would contain a field (e.g. ``addresses``) that holds an array of documents where each document has a field (e.g. ``loc:``) that holds location coordinates. For example: diff --git a/source/core/index-hashed.txt b/source/core/index-hashed.txt index e73f0eaf70c..cfe17184812 100644 --- a/source/core/index-hashed.txt +++ b/source/core/index-hashed.txt @@ -10,7 +10,7 @@ Hashed Index .. versionadded:: 2.4 Hashed indexes maintain entries with hashes of the values of the -indexed field. The hashing function collapses sub-documents and +indexed field. The hashing function collapses embedded documents and computes the hash for the entire value but does not support multi-key (i.e. arrays) indexes. diff --git a/source/core/index-multikey.txt b/source/core/index-multikey.txt index a0aa16c6c42..50ce4e7572d 100644 --- a/source/core/index-multikey.txt +++ b/source/core/index-multikey.txt @@ -72,9 +72,9 @@ Hashed Indexes ``hashed`` indexes are not compatible with multi-key indexes. To compute the hash for a ``hashed`` index, MongoDB collapses -sub-documents and computes the hash for the entire value. For fields -that hold arrays or sub-documents, you cannot use the index to support -queries that introspect the sub-document. +embedded documents and computes the hash for the entire value. For fields +that hold arrays or embedded documents, you cannot use the index to support +queries that introspect the embedded document. Examples -------- diff --git a/source/core/index-single.txt b/source/core/index-single.txt index f59309b9acb..6f7f5dcd836 100644 --- a/source/core/index-single.txt +++ b/source/core/index-single.txt @@ -86,13 +86,13 @@ Indexes on Embedded Fields .. default-domain:: mongodb -You can create indexes on fields embedded in sub-documents, just as you +You can create indexes on fields within embedded documents, just as you can index top-level fields in documents. Indexes on embedded fields -differ from :ref:`indexes on sub-documents `, +differ from :ref:`indexes on embedded documents `, which include the full content up to the maximum :limit:`index size -` of the sub-document in the index. Instead, indexes on +` of the embedded document in the index. Instead, indexes on embedded fields allow you to use a "dot notation," to introspect into -sub-documents. +embedded documents. Consider a collection named ``people`` that holds documents that resemble the following example document: @@ -117,16 +117,16 @@ following specification: .. index:: index; subdocuments .. _index-subdocuments: -.. _index-sub-documents: +.. _index-embedded-documents: .. _index-subdocument: -.. _index-sub-document: +.. _index-embedded-document: -Indexes on Subdocuments -~~~~~~~~~~~~~~~~~~~~~~~~ +Indexes on Embedded Dcuments +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. default-domain:: mongodb -You can also create indexes on subdocuments. +You can also create indexes on embedded documents. For example, the ``factories`` collection contains documents that contain a ``metro`` field, such as: @@ -142,7 +142,7 @@ contain a ``metro`` field, such as: name: "Giant Factory" } -The ``metro`` field is a subdocument, containing the embedded fields +The ``metro`` field is an embedded document, containing the embedded fields ``city`` and ``state``. The following command creates an index on the ``metro`` field as a whole: @@ -157,7 +157,7 @@ The following query can use the index on the ``metro`` field: db.factories.find( { metro: { city: "New York", state: "NY" } } ) This query returns the above document. When performing equality matches -on subdocuments, field order matters and the subdocuments must match +on embedded documents, field order matters and the embedded documents must match exactly. For example, the following query does not match the above document: @@ -165,5 +165,5 @@ document: db.factories.find( { metro: { state: "NY", city: "New York" } } ) -See :ref:`query-subdocuments` for more information regarding querying -on subdocuments. +See :ref:`query-embedded-documents` for more information regarding querying +on embedded documents. diff --git a/source/core/index-types.txt b/source/core/index-types.txt index 9b96faa5f99..3f90c0bf050 100644 --- a/source/core/index-types.txt +++ b/source/core/index-types.txt @@ -9,7 +9,7 @@ Index Types MongoDB provides a number of different index types. You can create indexes on any field or embedded field within a document or -sub-document. You can create :doc:`single field indexes +embedded document. You can create :doc:`single field indexes ` or :doc:`compound indexes `. MongoDB also supports indexes of arrays, called :ref:`multi-key indexes `, as well as diff --git a/source/core/query-optimization.txt b/source/core/query-optimization.txt index d885915b71e..0d41973b739 100644 --- a/source/core/query-optimization.txt +++ b/source/core/query-optimization.txt @@ -144,7 +144,7 @@ An index **cannot** cover a query if: a :ref:`multi-key index ` index and cannot support a covered query. -- any of the returned indexed fields are fields in subdocuments. +- any of the returned indexed fields are fields in embedded documents. [#index-embedded-document-fields]_ For example, consider a collection ``users`` with documents of the following form: @@ -189,4 +189,4 @@ method and review the :ref:`results `. For more information see :ref:`indexes-measuring-use`. .. [#index-embedded-document-fields] To index fields - in subdocuments, use :term:`dot notation`. + in embedded documents, use :term:`dot notation`. diff --git a/source/faq/developers.txt b/source/faq/developers.txt index d3073635dac..e7955ab1365 100644 --- a/source/faq/developers.txt +++ b/source/faq/developers.txt @@ -680,7 +680,7 @@ then you should maintain that model. If, however, you can group these small documents by some logical relationship *and* you frequently retrieve the documents by this grouping, you might consider "rolling-up" the small documents into -larger documents that contain an array of subdocuments. Keep in mind +larger documents that contain an array of embedded documents. Keep in mind that if you often only need to retrieve a subset of the documents within the group, then "rolling-up" the documents may not provide better performance. diff --git a/source/includes/apiargs-command-geoNear-field.yaml b/source/includes/apiargs-command-geoNear-field.yaml index d7ff143c8c5..00417fc109e 100644 --- a/source/includes/apiargs-command-geoNear-field.yaml +++ b/source/includes/apiargs-command-geoNear-field.yaml @@ -137,8 +137,8 @@ description: | If this is ``true``, the query returns the location of the matching documents in the results. The default is ``false``. This option is useful when a location field - contains multiple locations. To specify a field within a - subdocument, use :term:`dot notation`. + contains multiple locations. To specify a field within an + embedded document, use :term:`dot notation`. interface: command name: includeLocs operation: geoNear diff --git a/source/includes/apiargs-pipeline-geoNear-field.yaml b/source/includes/apiargs-pipeline-geoNear-field.yaml index d763cfacd38..79366c20d3f 100644 --- a/source/includes/apiargs-pipeline-geoNear-field.yaml +++ b/source/includes/apiargs-pipeline-geoNear-field.yaml @@ -13,7 +13,7 @@ source: arg_name: field description: | The output field that contains the - calculated distance. To specify a field within a subdocument, + calculated distance. To specify a field within an embedded document, use :term:`dot notation`. interface: pipeline name: distanceField @@ -70,8 +70,8 @@ arg_name: field description: | This specifies the output field that identifies the location used to calculate the distance. This option is useful when a location field - contains multiple locations. To specify a field within a - subdocument, use :term:`dot notation`. + contains multiple locations. To specify a field within an + embedded document, use :term:`dot notation`. interface: pipeline name: includeLocs operation: geoNear diff --git a/source/includes/fact-positional-projection-vs-elemmatch.rst b/source/includes/fact-positional-projection-vs-elemmatch.rst index 1412320ea08..5239bf8a380 100644 --- a/source/includes/fact-positional-projection-vs-elemmatch.rst +++ b/source/includes/fact-positional-projection-vs-elemmatch.rst @@ -6,5 +6,5 @@ from the query statement. The :projection:`$elemMatch` projection operator takes an explicit condition argument. This allows you to project based on a condition not in the query, or -if you need to project based on multiple fields in the array's subdocuments. +if you need to project based on multiple fields in the array's embedded documents. See :ref:`array-field-limitation` for an example. diff --git a/source/meta/style-guide.txt b/source/meta/style-guide.txt index 9133cf34320..5b04e1faa61 100644 --- a/source/meta/style-guide.txt +++ b/source/meta/style-guide.txt @@ -342,7 +342,7 @@ Jargon and Common Terms able to refer generically to instances (that may be either :program:`mongod` or :program:`mongos`.) - * - sub-document + * - embedded document - An embedded or nested document within a document or an array. - embedded document, nested document - @@ -468,7 +468,7 @@ Data Structure Terms - "value" refers to the contents of a "field". -- "sub-document" describes a nested document. +- "embedded document" describes a nested document. Other Terms ~~~~~~~~~~~ @@ -485,5 +485,5 @@ Notes on Specific Features - Geo-Location #. While MongoDB *is capable* of storing coordinates in - sub-documents, in practice, users should only store coordinates + embedded documents, in practice, users should only store coordinates in arrays. (See: `DOCS-41 `_.) diff --git a/source/reference/command/connPoolStats.txt b/source/reference/command/connPoolStats.txt index eb59eee6334..d9bd502008f 100644 --- a/source/reference/command/connPoolStats.txt +++ b/source/reference/command/connPoolStats.txt @@ -30,7 +30,7 @@ Output .. data:: connPoolStats.hosts - The sub-documents of the :data:`~connPoolStats.hosts` :term:`document` report connections + The embedded documents of the :data:`~connPoolStats.hosts` :term:`document` report connections between the :program:`mongos` or :program:`mongod` instance and each component :program:`mongod` of the :term:`sharded cluster`. @@ -136,7 +136,7 @@ Output connection pools. :program:`mongos` connect to :program:`mongod` instances using one - of three types of connections. The following sub-document reports + of three types of connections. The following embedded document reports the total number of connections by type. .. data:: connPoolStats.createdByType.master diff --git a/source/reference/command/distinct.txt b/source/reference/command/distinct.txt index 4e6022e2ed9..f39b5cb6573 100644 --- a/source/reference/command/distinct.txt +++ b/source/reference/command/distinct.txt @@ -12,7 +12,7 @@ Definition Finds the distinct values for a specified field across a single collection. :dbcommand:`distinct` returns a document that contains an array of the distinct values. The return document also contains - a subdocument with query statistics and the query plan. + an embedded document with query statistics and the query plan. When possible, the :dbcommand:`distinct` command uses an index to find documents and return values. @@ -38,7 +38,7 @@ documents in the ``orders`` collection: db.runCommand ( { distinct: "orders", key: "ord_dt" } ) Return an array of the distinct values of the field ``sku`` in the -subdocument ``item`` from all documents in the ``orders`` collection: +embedded document ``item`` from all documents in the ``orders`` collection: .. code-block:: javascript diff --git a/source/reference/command/hostInfo.txt b/source/reference/command/hostInfo.txt index 68a2c209768..60ad84f35ee 100644 --- a/source/reference/command/hostInfo.txt +++ b/source/reference/command/hostInfo.txt @@ -65,8 +65,8 @@ hostInfo .. data:: hostInfo.system - A sub-document about the underlying environment of the system - running the :program:`mongod` or :program:`mongos` + An embedded document providing information about the underlying + environment of the system running the :program:`mongod` or :program:`mongos` .. data:: hostInfo.system.currentTime @@ -102,7 +102,7 @@ hostInfo .. data:: hostInfo.os - A sub-document that contains information about the operating + An embedded document that contains information about the operating system running the :program:`mongod` and :program:`mongos`. .. data:: hostInfo.os.type @@ -122,9 +122,9 @@ hostInfo .. data:: hostInfo.extra - A sub-document with extra information about the operating system + An embedded document with extra information about the operating system and the underlying hardware. The content of the - :data:`~hostInfo.extra` sub-document depends on the operating + :data:`~hostInfo.extra` embedded document depends on the operating system. .. data:: hostInfo.extra.versionString diff --git a/source/reference/command/serverStatus.txt b/source/reference/command/serverStatus.txt index 18c3980bc36..57f1bed49b7 100644 --- a/source/reference/command/serverStatus.txt +++ b/source/reference/command/serverStatus.txt @@ -442,7 +442,7 @@ the :doc:`/reference/server-status` page. index use. .. versionchanged:: 2.4 - Fields previously in the ``btree`` sub-document of + Fields previously in the ``btree`` embedded document of :data:`~serverStatus.indexCounters` are now fields in the :data:`~serverStatus.indexCounters` document. @@ -1433,7 +1433,7 @@ page. .. data:: serverStatus.metrics.getLastError.wtime - :data:`~serverStatus.metrics.getLastError.wtime` is a sub-document + :data:`~serverStatus.metrics.getLastError.wtime` is an embedded document that reports :dbcommand:`getLastError` operation counts with a ``w`` argument greater than ``1``. @@ -1463,7 +1463,7 @@ page. .. data:: serverStatus.metrics.operation - :data:`~serverStatus.metrics.operation` is a sub-document that + :data:`~serverStatus.metrics.operation` is an embedded document that holds counters for several types of update and query operations that MongoDB handles using special operation types. @@ -1519,7 +1519,7 @@ page. .. data:: serverStatus.metrics.repl - :data:`~serverStatus.metrics.repl` holds a sub-document that + :data:`~serverStatus.metrics.repl` holds an embedded document that reports metrics related to the replication process. :data:`~serverStatus.metrics.repl` document appears on all :program:`mongod` instances, even those that aren't members of @@ -1527,7 +1527,7 @@ page. .. data:: serverStatus.metrics.repl.apply - :data:`~serverStatus.metrics.repl.apply` holds a sub-document that + :data:`~serverStatus.metrics.repl.apply` holds an embedded document that reports on the application of operations from the replication :term:`oplog`. @@ -1672,7 +1672,7 @@ page. .. data:: serverStatus.metrics.repl.preload.docs - :data:`~serverStatus.metrics.repl.preload.docs` is a sub-document + :data:`~serverStatus.metrics.repl.preload.docs` is an embedded document that reports on the documents loaded into memory during the *pre-fetch* stage. @@ -1690,8 +1690,8 @@ page. .. data:: serverStatus.metrics.repl.preload.indexes - :data:`~serverStatus.metrics.repl.preload.indexes` is a - sub-document that reports on the index items loaded into + :data:`~serverStatus.metrics.repl.preload.indexes` is an + embedded document that reports on the index items loaded into memory during the *pre-fetch* stage of replication. See :ref:`replica-set-internals-multi-threaded-replication` for @@ -1728,7 +1728,7 @@ page. .. data:: serverStatus.metrics.ttl - :data:`~serverStatus.metrics.ttl` is a sub-document that reports on + :data:`~serverStatus.metrics.ttl` is an embedded document that reports on the operation of the resource use of the :doc:`ttl index ` process. diff --git a/source/reference/command/validate.txt b/source/reference/command/validate.txt index 86d3cfc2858..cab866761e8 100644 --- a/source/reference/command/validate.txt +++ b/source/reference/command/validate.txt @@ -77,7 +77,7 @@ Output .. data:: validate.extents :dbcommand:`validate` returns one instance of this document for - every extent in the collection. This sub-document is only returned + every extent in the collection. This embedded document is only returned when you specify the ``full`` option to the command. .. data:: validate.extents.loc @@ -140,7 +140,7 @@ Output The size of the first extent created in this collection. This data is similar to the data provided by the :data:`~validate.extents` - sub-document; however, the data reflects only the first extent in + embedded document; however, the data reflects only the first extent in the collection and is always returned. .. data:: validate.firstExtentDetails.loc diff --git a/source/reference/command/writeBacksQueued.txt b/source/reference/command/writeBacksQueued.txt index 6c410159cb1..dcc3d7ea1b4 100644 --- a/source/reference/command/writeBacksQueued.txt +++ b/source/reference/command/writeBacksQueued.txt @@ -27,7 +27,7 @@ writeBacksQueued Document. - :data:`~writeBacksQueued.queues` holds a sub-document where the fields are all + :data:`~writeBacksQueued.queues` holds an embedded document where the fields are all write back queues. These field hold a document with two fields that reports on the state of the queue. The fields in these documents are: diff --git a/source/reference/local-database.txt b/source/reference/local-database.txt index bdd9a8e398c..db7117f9a71 100644 --- a/source/reference/local-database.txt +++ b/source/reference/local-database.txt @@ -95,7 +95,7 @@ Collection on all ``mongod`` Instances .. data:: local.startup_log.cmdLine - A sub-document that reports the :program:`mongod` runtime + An embedded document that reports the :program:`mongod` runtime options and their values. .. data:: local.startup_log.pid @@ -104,7 +104,7 @@ Collection on all ``mongod`` Instances .. data:: local.startup_log.buildinfo - A sub-document that reports information about the build + An embedded document that reports information about the build environment and settings used to compile this :program:`mongod`. This is the same output as :dbcommand:`buildInfo`. See :data:`buildInfo`. diff --git a/source/reference/method/cursor.sort.txt b/source/reference/method/cursor.sort.txt index 80751481dc3..705fb6f7178 100644 --- a/source/reference/method/cursor.sort.txt +++ b/source/reference/method/cursor.sort.txt @@ -167,8 +167,8 @@ The query returns the following documents, in descending order of { "_id" : 1, "item" : { "category" : "cake", "type" : "chiffon" }, "amount" : 10 } { "_id" : 6, "item" : { "category" : "brownies", "type" : "blondie" }, "amount" : 10 } -The following query specifies the sort order using the fields from a -sub-document ``item``. The query sorts first by the ``category`` field +The following query specifies the sort order using the fields from an +embedded document ``item``. The query sorts first by the ``category`` field in ascending order, and then within each ``category``, by the ``type`` field in ascending order. diff --git a/source/reference/method/db.collection.distinct.txt b/source/reference/method/db.collection.distinct.txt index ea6803c7911..ceb71bc77c2 100644 --- a/source/reference/method/db.collection.distinct.txt +++ b/source/reference/method/db.collection.distinct.txt @@ -37,7 +37,7 @@ method: db.orders.distinct( 'ord_dt' ) - Return an array of the distinct values of the field ``sku`` in the - subdocument ``item`` from all documents in the ``orders`` collection: + embedded document ``item`` from all documents in the ``orders`` collection: .. code-block:: javascript diff --git a/source/reference/method/db.collection.find.txt b/source/reference/method/db.collection.find.txt index 08d930465fa..6ba18970340 100644 --- a/source/reference/method/db.collection.find.txt +++ b/source/reference/method/db.collection.find.txt @@ -177,8 +177,8 @@ Query an Array of Documents ``````````````````````````` The following operation returns documents in the :doc:`bios collection -` where ``awards`` array contains a -subdocument element that contains the ``award`` field equal to ``"Turing +` where ``awards`` array contains an +embedded document element that contains the ``award`` field equal to ``"Turing Award"`` and the ``year`` field greater than 1980: .. code-block:: javascript @@ -195,15 +195,16 @@ Award"`` and the ``year`` field greater than 1980: ) .. _query-subdocuments: +.. _query-embedded-documents: -Query Subdocuments -~~~~~~~~~~~~~~~~~~ +Query Embedded Documents +~~~~~~~~~~~~~~~~~~~~~~~~ -Query Exact Matches on Subdocuments -``````````````````````````````````` +Query Exact Matches on Embedded Documents +````````````````````````````````````````` The following operation returns documents in the :doc:`bios collection -` where the subdocument ``name`` is +` where the embedded document ``name`` is *exactly* ``{ first: "Yukihiro", last: "Matsumoto" }``, including the order: @@ -218,7 +219,7 @@ order: } ) -The ``name`` field must match the sub-document exactly. The query does +The ``name`` field must match the embedded document exactly. The query does **not** match documents with the following ``name`` fields: .. code-block:: javascript @@ -234,14 +235,14 @@ The ``name`` field must match the sub-document exactly. The query does first: "Yukihiro" } -Query Fields of a Subdocument -````````````````````````````` +Query Fields of an Embedded Document +```````````````````````````````````` The following operation returns documents in the :doc:`bios collection -` where the subdocument ``name`` +` where the embedded document ``name`` contains a field ``first`` with the value ``"Yukihiro"`` and a field ``last`` with the value ``"Matsumoto"``. The query uses :term:`dot -notation` to access fields in a subdocument: +notation` to access fields in an embedded document: .. code-block:: javascript @@ -252,8 +253,8 @@ notation` to access fields in a subdocument: } ) -The query matches the document where the ``name`` field contains a -subdocument with the field ``first`` with the value ``"Yukihiro"`` and a +The query matches the document where the ``name`` field contains an +embedded document with the field ``first`` with the value ``"Yukihiro"`` and a field ``last`` with the value ``"Matsumoto"``. For instance, the query would match documents with ``name`` fields that held either of the following values: @@ -310,7 +311,7 @@ Explicitly Excluded Fields The following operation queries the :doc:`bios collection ` and returns all fields *except* -the ``first`` field in the ``name`` subdocument and the ``birth`` +the ``first`` field in the ``name`` embedded document and the ``birth`` field: .. code-block:: javascript @@ -350,12 +351,12 @@ field and the ``contribs`` field: { name: 1, contribs: 1, _id: 0 } ) -On Arrays and Subdocuments -`````````````````````````` +On Arrays and Embedded Documents +```````````````````````````````` The following operation queries the :doc:`bios collection ` and returns the ``last`` field in -the ``name`` subdocument and the first two elements in the ``contribs`` +the ``name`` embedded document and the first two elements in the ``contribs`` array: .. code-block:: javascript diff --git a/source/reference/method/db.collection.findAndModify.txt b/source/reference/method/db.collection.findAndModify.txt index 11db9a970b2..fe00916bcce 100644 --- a/source/reference/method/db.collection.findAndModify.txt +++ b/source/reference/method/db.collection.findAndModify.txt @@ -36,7 +36,7 @@ Definition }); The :method:`db.collection.findAndModify()` method takes a document - parameter with the following subdocument fields: + parameter with the following embedded document fields: .. |operation| replace:: :method:`~db.collection.findAndModify()` diff --git a/source/reference/method/db.collection.findOne.txt b/source/reference/method/db.collection.findOne.txt index c7f77da453b..c5c76dc533c 100644 --- a/source/reference/method/db.collection.findOne.txt +++ b/source/reference/method/db.collection.findOne.txt @@ -65,7 +65,7 @@ With a Query Specification The following operation returns the first matching document from the :doc:`bios collection ` where either -the field ``first`` in the subdocument ``name`` starts with the letter +the field ``first`` in the embedded document ``name`` starts with the letter ``G`` **or** where the field ``birth`` is less than ``new Date('01/01/1945')``: @@ -107,7 +107,7 @@ Return All but the Excluded Fields The following operation returns a document in the :doc:`bios collection ` where the ``contribs`` field contains the element ``OOP`` and returns all fields *except* the ``_id`` -field, the ``first`` field in the ``name`` subdocument, and the +field, the ``first`` field in the ``name`` embedded document, and the ``birth`` field: .. code-block:: javascript diff --git a/source/reference/method/sh._lastMigration.txt b/source/reference/method/sh._lastMigration.txt index 171d407bf17..69cd3110e87 100644 --- a/source/reference/method/sh._lastMigration.txt +++ b/source/reference/method/sh._lastMigration.txt @@ -51,5 +51,5 @@ document contains the following output: .. data:: sh._lastMigration.details A document containing details about the migrated chunk. The document - includes ``min`` and ``max`` sub-documents with the bounds of the + includes ``min`` and ``max`` embedded documents with the bounds of the migrated chunk. diff --git a/source/reference/operator/aggregation/redact.txt b/source/reference/operator/aggregation/redact.txt index 3316e82c9db..1a7203e6583 100644 --- a/source/reference/operator/aggregation/redact.txt +++ b/source/reference/operator/aggregation/redact.txt @@ -37,26 +37,26 @@ Definition * - _`$$DESCEND` - - :pipeline:`$redact` returns the *non-subdocument* fields at - the current document/subdocument level. For subdocuments or - subdocuments in arrays, apply the :expression:`$cond` - expression to the subdocuments to determine access for these - subdocuments. + - :pipeline:`$redact` returns the fields at the current document level, + excluding embedded documents. To include embedded documents and + embedded documents within arrays, apply the :expression:`$cond` + expression to the embedded documents to determine access for these + embedded documents. * - _`$$PRUNE` - :pipeline:`$redact` excludes all fields at this current - document/subdocument level, **without** further inspection of + document/embedded document level, **without** further inspection of any of the excluded fields. This applies even if the excluded - field contains subdocuments that may have different access + field contains embedded documents that may have different access levels. * - _`$$KEEP` - :pipeline:`$redact` returns or keeps all fields at this - current document/subdocument level, **without** further + current document/embedded document level, **without** further inspection of the fields at this level. This applies even if - the included field contains subdocuments that may have + the included field contains embedded documents that may have different access levels. Examples @@ -66,12 +66,12 @@ The examples in this section use the :method:`db.collection.aggregate()` helper provided in the 2.6 version of the :program:`mongo` shell. -Evaluate Access at Every Document/Sub-document Level -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Evaluate Access at Every Document Level +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A ``forecasts`` collection contains documents of the following form where the ``tags`` field lists the different access values for that -document/subdocument level; i.e. a value of ``[ "G", "STLW" ]`` +document/embedded document level; i.e. a value of ``[ "G", "STLW" ]`` specifies either ``"G"`` or ``"STLW"`` can access the data: .. code-block:: javascript @@ -192,7 +192,7 @@ In this example document, the ``level`` field determines the access level required to view the data. To run a query on all documents with status ``A`` and exclude *all* -fields contained in a document/subdocument at level ``5``, include a +fields contained in a document/embedded document at level ``5``, include a :pipeline:`$redact` stage that specifies the system variable ``"$$PRUNE"`` in the ``then`` field: @@ -215,7 +215,7 @@ fields contained in a document/subdocument at level ``5``, include a The :pipeline:`$redact` stage evaluates the ``level`` field to determine access. If the ``level`` field equals ``5``, then exclude all -fields at that level, even if the excluded field contains subdocuments +fields at that level, even if the excluded field contains embedded documents that may have different ``level`` values, such as the ``shipping_addr`` field. @@ -232,7 +232,7 @@ The aggregation operation returns the following "redacted" document: The result set shows that the :pipeline:`$redact` stage excluded the field ``cc`` as a whole, including the ``shipping_addr`` field -which contained subdocuments that had ``level`` field values equal to +which contained embedded documents that had ``level`` field values equal to ``3`` and not ``5``. .. seealso:: :doc:`/tutorial/implement-field-level-redaction` for diff --git a/source/reference/operator/projection/positional.txt b/source/reference/operator/projection/positional.txt index a8d23562f0e..49b28825066 100644 --- a/source/reference/operator/projection/positional.txt +++ b/source/reference/operator/projection/positional.txt @@ -71,7 +71,7 @@ Under these requirements, the following query is **incorrect**: To specify criteria on multiple fields of documents inside that array, use the :query:`$elemMatch` query operator. The following query will return any -subdocuments inside a ``grades`` array that have a ``mean`` of greater than 70 +embedded documents inside a ``grades`` array that have a ``mean`` of greater than 70 and a ``grade`` of greater than 90. .. code-block:: javascript diff --git a/source/reference/operator/query/eq.txt b/source/reference/operator/query/eq.txt index 5ca6f33d591..344aaf24499 100644 --- a/source/reference/operator/query/eq.txt +++ b/source/reference/operator/query/eq.txt @@ -100,7 +100,7 @@ Both queries match the following document: { _id: 1, item: { name: "ab", code: "123" }, qty: 15, tags: [ "A", "B", "C" ] } -.. seealso:: :ref:`Query Embedded Documents ` +.. seealso:: :ref:`Query Embedded Documents ` Array Element Equals a Value ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/source/release-notes/2.0.txt b/source/release-notes/2.0.txt index 45219846798..8163b5c6c2c 100644 --- a/source/release-notes/2.0.txt +++ b/source/release-notes/2.0.txt @@ -282,7 +282,7 @@ Multi-Location Documents ```````````````````````` Indexing is now supported on documents which have multiple location -objects, embedded either inline or in nested sub-documents. Additional +objects, embedded either inline or in embedded documents. Additional command options are also supported, allowing results to return with not only distance but the location used to generate the distance. diff --git a/source/tutorial/configure-replica-set-tag-sets.txt b/source/tutorial/configure-replica-set-tag-sets.txt index 1bf29539c5a..dfe262f8a3e 100644 --- a/source/tutorial/configure-replica-set-tag-sets.txt +++ b/source/tutorial/configure-replica-set-tag-sets.txt @@ -13,7 +13,7 @@ Tag sets let you customize :term:`write concern` and :term:`read preferences ` for a :term:`replica set`. MongoDB stores tag sets in the replica set configuration object, which is the document returned by :method:`rs.conf()`, in the :data:`members[n].tags -` sub-document. +` embedded document. This section introduces the configuration of tag sets. For an overview on tag sets and their use, see diff --git a/source/tutorial/create-a-hashed-index.txt b/source/tutorial/create-a-hashed-index.txt index bc028419362..5f2c6360d96 100644 --- a/source/tutorial/create-a-hashed-index.txt +++ b/source/tutorial/create-a-hashed-index.txt @@ -38,7 +38,7 @@ Considerations -------------- MongoDB supports ``hashed`` indexes of any single field. The hashing -function collapses sub-documents and computes the hash for the entire +function collapses embedded documents and computes the hash for the entire value, but does not support multi-key (i.e. arrays) indexes. You may not create compound indexes that have ``hashed`` index fields. diff --git a/source/tutorial/implement-field-level-redaction.txt b/source/tutorial/implement-field-level-redaction.txt index 8426f925461..dc9c656b747 100644 --- a/source/tutorial/implement-field-level-redaction.txt +++ b/source/tutorial/implement-field-level-redaction.txt @@ -10,7 +10,7 @@ documents based on information stored in the documents themselves. .. include:: /images/redact-security-architecture.rst To store the access criteria data, add a field to the documents and -subdocuments. To allow for multiple combinations of access levels for +embedded documents. To allow for multiple combinations of access levels for the same data, consider setting the access field to an array of arrays. Each array element contains a required set that allows a user with that set to access the data. diff --git a/source/tutorial/limit-number-of-elements-in-updated-array.txt b/source/tutorial/limit-number-of-elements-in-updated-array.txt index f1aa4ad31d3..c844ecc8e41 100644 --- a/source/tutorial/limit-number-of-elements-in-updated-array.txt +++ b/source/tutorial/limit-number-of-elements-in-updated-array.txt @@ -64,7 +64,7 @@ The following update uses the :update:`$push` operator with: .. note:: When using the :update:`$sort` modifier on the array element, - access the field in the subdocument element directly instead of + access the field in the embedded document element directly instead of using the :term:`dot notation` on the array field. After the operation, the document contains only the top 3 scores in diff --git a/source/tutorial/manage-chained-replication.txt b/source/tutorial/manage-chained-replication.txt index 7e2119cd759..8ebec8fa4cf 100644 --- a/source/tutorial/manage-chained-replication.txt +++ b/source/tutorial/manage-chained-replication.txt @@ -49,13 +49,13 @@ You can use the following sequence of commands to set cfg = rs.config() #. Take note of whether the current configuration settings contain the - ``settings`` sub-document. If they do, skip this step. + ``settings`` embedded document. If they do, skip this step. .. warning:: To avoid data loss, skip this step if the configuration - settings contain the ``settings`` sub-document. + settings contain the ``settings`` embedded document. If the current configuration settings **do not** contain the - ``settings`` sub-document, create the sub-document by issuing the + ``settings`` embedded document, create the embedded document by issuing the following command: .. code-block:: javascript diff --git a/source/tutorial/query-documents.txt b/source/tutorial/query-documents.txt index 358420b324f..a5ad2a9dc0a 100644 --- a/source/tutorial/query-documents.txt +++ b/source/tutorial/query-documents.txt @@ -144,6 +144,7 @@ than (:query:`$lt`) ``9.95``: starting from here. .. _read-operations-subdocuments: +.. _read-operations-embedded-documents: Embedded Documents ------------------ @@ -387,7 +388,7 @@ Match a Field in the Embedded Document Using the Array Index ```````````````````````````````````````````````````````````` If you know the array index of the embedded document, you can specify -the document using the subdocument's position using the :term:`dot +the document using the embedded document's position using the :term:`dot notation`. The following example selects all documents where the ``memos`` @@ -417,7 +418,7 @@ Match a Field Without Specifying Array Index If you do not know the index position of the document in the array, concatenate the name of the field that contains the array, with a dot -(``.``) and the name of the field in the subdocument. +(``.``) and the name of the field in the embedded document. The following example selects all documents where the ``memos`` field contains an array that contains at least one embedded document that diff --git a/source/tutorial/specify-language-for-text-index.txt b/source/tutorial/specify-language-for-text-index.txt index 19454a41b1a..7817dc91688 100644 --- a/source/tutorial/specify-language-for-text-index.txt +++ b/source/tutorial/specify-language-for-text-index.txt @@ -41,23 +41,23 @@ Create a ``text`` Index for a Collection in Multiple Languages .. versionchanged:: 2.6 - Added support for language overrides within sub-documents. + Added support for language overrides within embedded documents. Specify the Index Language within the Document ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -If a collection contains documents or sub-documents that are in +If a collection contains documents or embedded documents that are in different languages, include a field named ``language`` in the -documents or sub-documents and specify as its value the language for -that document or sub-document. +documents or embedded documents and specify as its value the language for +that document or embedded document. MongoDB will use the specified language for that document or -sub-document when building the ``text`` index: +embedded document when building the ``text`` index: - The specified language in the document overrides the default language for the ``text`` index. -- The specified language in a sub-document override the language +- The specified language in an embedded document override the language specified in an enclosing document or the default language for the index. @@ -65,7 +65,7 @@ See :ref:`text-search-languages` for a list of supported languages. For example, a collection ``quotes`` contains multi-language documents that include the ``language`` field in the document and/or the -sub-document as needed: +embedded document as needed: .. code-block:: javascript @@ -118,16 +118,16 @@ language of English. db.quotes.createIndex( { original: "text", "translation.quote": "text" } ) -Then, for the documents and subdocuments that contain the ``language`` +Then, for the documents and embedded documents that contain the ``language`` field, the ``text`` index uses that language to parse word stems and other linguistic characteristics. -For sub-documents that do not contain the ``language`` field, +For embedded documents that do not contain the ``language`` field, - If the enclosing document contains the ``language`` field, then the - index uses the document's language for the sub-document. + index uses the document's language for the embedded document. -- Otherwise, the index uses the default language for the sub-documents. +- Otherwise, the index uses the default language for the embedded documents. For documents that do not contain the ``language`` field, the index uses the default language, which is English.