Docs Menu
Docs Home
/ /

Other Uses of the Document Structure

In addition to defining data records, MongoDB uses the document structure throughout, including but not limited to: query filters, update specifications documents, and index specification documents

Query filter documents specify the conditions that determine which records to select for read, update, and delete operations.

You can use <field>:<value> expressions to specify the equality condition and query operator expressions.

{
<field1>: <value1>,
<field2>: { <operator>: <value> },
...
}

For examples, see:

Update specification documents use update operators to specify the data modifications to perform on specific fields during an update operation.

{
<operator1>: { <field1>: <value1>, ... },
<operator2>: { <field2>: <value2>, ... },
...
}

For examples, see Update specifications.

Index specification documents define the field to index and the index type:

{ <field1>: <type1>, <field2>: <type2>, ... }

Back

Documents

On this page