Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions source/reference/method/db.collection.findAndModify-param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
object:
name: db.collection.findAndModify()
type: method
field:
optional: true
type: param
name: query
type: document
position: 1
description: |
The selection criteria for the modification. The ``query`` field
employs the same :ref:`query selectors <query-selectors>` as used in
the :method:`db.collection.find()` method. Although the query may
match multiple documents, :method:`~db.collection.findAndModify()`
will select only one document to modify.
---
object:
name: db.collection.findAndModify()
type: method
field:
optional: true
type: param
name: sort
type: document
position: 2
description: |
Determines which document the operation modifies if the query selects
multiple documents. :method:`~db.collection.findAndModify()` modifies
the first document in the sort order specified by this argument.
---
object:
name: db.collection.findAndModify()
type: method
field:
optional: true
type: param
name: remove
type: Boolean
position: 3
description: |
Removes the document specified in the ``update`` field. Set this to
``true`` to remove the selected document . The default is ``false``.
---
object:
name: db.collection.findAndModify()
type: method
field:
optional: true
type: param
name: update
type: document
position: 4
description: |
Performs an update of the selected document. The ``update`` field
employs the same :ref:`update operators <update-operators>` or
``field: value`` specifications to modify the selected document.
---
object:
name: db.collection.findAndModify()
type: method
field:
optional: true
type: param
name: new
type: Boolean
position: 5
description: |
When ``true``, returns the modified document rather than the original.
The :method:`~db.collection.findAndModify()` method ignores the
``new`` option for ``remove`` operations. The default is ``false``.
---
object:
name: db.collection.findAndModify()
type: method
field:
optional: true
type: param
name: fields
type: document
position: 6
description: |
A subset of fields to return. The ``fields`` document specifies an
inclusion of a field with ``1``, as in: ``fields: { <field1>: 1,
<field2>: 1, ... }``. See :ref:`projection <read-operations-projection>`.
---
object:
name: db.collection.findAndModify()
type: method
field:
optional: true
type: param
name: upsert
type: Boolean
position: 7
description: |
Used in conjunction with the ``update`` field. When ``true``,
:method:`~db.collection.findAndModify()` creates a new document if the
``query`` returns no documents. The default is ``false``.
...
Loading