Skip to main content
Deno 2 is finally here 🎉️
Learn more
Latest
interface FindAndModifyOptions
import { type FindAndModifyOptions } from "https://deno.land/x/model@v1.2/dependencies/mongo.ts";

Options for the findAndModify operation

Properties

optional
sort: Document

Control the order in which documents are found. findAndModify only modifies the first document found, so controlling the sort order may ensure, that the right document is first

optional
update: UpdateFilter<T>

The update to execute on the found document.

Either update or remove have to be specified

optional
remove: boolean

Remove the found document

optional
new: boolean

Return the new state after the update

optional
fields: Document

the fields to return.

optional
upsert: boolean

perform an upsert, i.e. update if a document matches, insert otherwise.

optional
bypassDocumentValidation: boolean

do not validate the document during the operation

optional
writeConcern: WriteConcern

The write concern to apply to the write operation

optional
collation: CollationOptions

The collation options to apply to string handling (e.g. during sort)

optional
arrayFilters: Document[]

Filters determining which elements to modify in an array, when modifying array values

optional
maxTimeMS: number

The maximum time of milliseconds the operation is allowed to take