vibe.db.mongo.impl.crud

MongoDB CRUD API definitions.

Types 22

deprecated Use UpdateOptions instead
none = 0Normal update of a single document.
upsert = 1 << 0Creates a document if none exists.
multiUpdate = 1 << 1Updates all matching documents.
None = noneDeprecated compatibility alias
Upsert = upsertDeprecated compatibility alias
MultiUpdate = multiUpdateDeprecated compatibility alias
deprecated Use InsertOneOptions or InsertManyOptions instead
none = 0Normal insert.
continueOnError = 1 << 0For multiple inserted documents, continues inserting further documents after a failure.
None = noneDeprecated compatibility alias
ContinueOnError = continueOnErrorDeprecated compatibility alias
deprecated Use FindOptions instead
none = 0Normal query
tailableCursor = 1 << 1
slaveOk = 1 << 2
oplogReplay = 1 << 3
noCursorTimeout = 1 << 4
awaitData = 1 << 5
exhaust = 1 << 6
partial = 1 << 7
None = noneDeprecated compatibility alias
TailableCursor = tailableCursorDeprecated compatibility alias
SlaveOk = slaveOkDeprecated compatibility alias
OplogReplay = oplogReplayDeprecated compatibility alias
NoCursorTimeout = noCursorTimeoutDeprecated compatibility alias
AwaitData = awaitDataDeprecated compatibility alias
Exhaust = exhaustDeprecated compatibility alias
Partial = partialDeprecated compatibility alias
deprecated Use DeleteOptions instead
none = 0
singleRemove = 1 << 0
None = noneDeprecated compatibility alias
SingleRemove = singleRemoveDeprecated compatibility alias
Fields
Nullable!bool allowDiskUseEnables writing to temporary files on the server. When set to true, the server can write temporary data to disk while executing the find operation.
Nullable!bool allowPartialResultsGet partial results from a mongos if some shards are down (instead of throwing an error).
Nullable!int batchSizeThe number of documents to return per batch.
Nullable!bool singleBatchDetermines whether to close the cursor after the first batch.
Nullable!Collation collationCollation allows users to specify language-specific rules for string comparison, such as rules for letter-case and accent marks.
Nullable!string commentUsers can specify an arbitrary string to help trace the operation through the database profiler, currentOp, and logs.
CursorType cursorTypeIndicates the type of cursor to use. This value includes both the tailable and awaitData options.
Nullable!Bson hintThe index to use. Specify either the index name as a string or the index key pattern.
Nullable!long limitThe maximum number of documents to return.
Nullable!Bson maxThe exclusive upper bound for a specific index.
Nullable!long maxAwaitTimeMSThe maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies to a TAILABLEAWAIT cursor. When the cursor is not a TAILABLEAWAIT cursor, th...
Nullable!long maxScanMaximum number of documents or index keys to scan when executing the query.
Nullable!long maxTimeMSThe maximum amount of time to allow the query to run.
Nullable!Bson minThe exclusive lower bound for a specific index.
Nullable!bool noCursorTimeoutThe server normally times out idle cursors after an inactivity period (10 minutes) to prevent excess memory use. Set this option to prevent that.
Nullable!bool oplogReplayEnables optimization when querying the oplog for a range of ts values.
Nullable!Bson projectionLimits the fields to return for all matching documents.
Nullable!bool returnKeyIf true, returns only the index keys in the resulting documents.
Nullable!bool showRecordIdDetermines whether to return the record identifier for each document. If true, adds a field $recordId to the returned documents.
Nullable!long skipThe number of documents to skip before returning.
Nullable!bool snapshotPrevents the cursor from returning a document more than once because of an intervening write operation.
Nullable!Bson sortThe order in which to return matching documents.
Nullable!bool orderedIf true, when an insert fails, return without performing the remaining writes. If false, when a write fails, continue with the remaining writes, if any.
Nullable!ReadConcern readConcernSpecifies the read concern. Only compatible with a write stage. (e.g. `$out`, `$merge`)
Methods
void maxAwaitTime(Duration d) @safeditto
void maxTime(Duration d) @safeditto
nonTailableThe default value. A vast majority of cursors will be of this type.
tailableTailable means the cursor is not closed when the last data is retrieved. Rather, the cursor marks the final object’s position. You can resume using the cursor later, from where it was located, if...
tailableAwaitCombines the tailable option with awaitData, as defined below.
Fields
Nullable!Collation collationCollation allows users to specify language-specific rules for string comparison, such as rules for letter-case and accent marks.
Nullable!long maxTimeMSThe maximum amount of time to allow the query to run.
Nullable!ReadConcern readConcernSpecifies the read concern. Only compatible with a write stage. (e.g. `$out`, `$merge`)
Nullable!string commentUsers can specify an arbitrary string to help trace the operation through the database profiler, currentOp, and logs.
Methods
void maxTime(Duration d) @safeditto
Fields
Nullable!Collation collationCollation allows users to specify language-specific rules for string comparison, such as rules for letter-case and accent marks.
Nullable!Bson hintThe index to use. Specify either the index name as a string or the index key pattern.
Nullable!long limitThe maximum number of documents to return.
Nullable!long maxTimeMSThe maximum amount of time to allow the query to run.
Nullable!long skipThe number of documents to skip before returning.
Nullable!ReadConcern readConcernSpecifies the read concern. Only compatible with a write stage. (e.g. `$out`, `$merge`)
Methods
void maxTime(Duration d) @safeditto
Fields
Nullable!bool explain
Nullable!bool allowDiskUseEnables writing to temporary files. When set to true, aggregation operations can write data to the tmp subdirectory in the dbPath directory.
Nullable!bool bypassDocumentValidationIf true, allows the write to opt-out of document level validation. This only applies when the $out or $merge stage is specified.
Nullable!Collation collationCollation allows users to specify language-specific rules for string comparison, such as rules for letter-case and accent marks.
Nullable!string commentUsers can specify an arbitrary string to help trace the operation through the database profiler, currentOp, and logs.
Nullable!long maxAwaitTimeMSThe maximum amount of time for the server to wait on new documents to satisfy a tailable cursor query. This only applies to a TAILABLEAWAIT cursor. When the cursor is not a TAILABLEAWAIT cursor, th...
Nullable!long maxTimeMSSpecifies a time limit in milliseconds for processing operations on a cursor. If you do not specify a value for maxTimeMS, operations will not time out.
Nullable!Bson hintThe index to use for the aggregation. The index is on the initial collection / view against which the aggregation is run.
Nullable!Bson letMap of parameter names and values. Values must be constant or closed expressions that do not reference document fields. Parameters can then be accessed as variables in an aggregate expression conte...
Nullable!ReadConcern readConcernSpecifies the read concern. Only compatible with a write stage. (e.g. `$out`, `$merge`)
Methods
inout(Nullable!int) batchSize() ref return @property inout @safe pure nothrow @nogc @ignoreSpecifies the initial batch size for the cursor.
void maxAwaitTime(Duration d) @safeditto
void maxTime(Duration d) @safeditto
Fields
Nullable!bool orderedIf true, when a write fails, return without performing the remaining writes. If false, when a write fails, continue with the remaining writes, if any.
Nullable!bool bypassDocumentValidationIf true, allows the write to opt-out of document level validation.
Nullable!WriteConcern writeConcernA document that expresses the https://www.mongodb.com/docs/manual/reference/write-concern/ of the insert command. Omit to use the default write concern.
Nullable!string commentUsers can specify an arbitrary string to help trace the operation through the database profiler, currentOp, and logs.
Fields
Nullable!bool bypassDocumentValidationIf true, allows the write to opt-out of document level validation.
Nullable!WriteConcern writeConcernA document that expresses the https://www.mongodb.com/docs/manual/reference/write-concern/ of the insert command. Omit to use the default write concern.
Nullable!string commentUsers can specify an arbitrary string to help trace the operation through the database profiler, currentOp, and logs.
Fields
Nullable!bool bypassDocumentValidationIf true, allows the write to opt-out of document level validation.
Nullable!bool orderedIf true, when an insert fails, return without performing the remaining writes. If false, when a write fails, continue with the remaining writes, if any.
Nullable!WriteConcern writeConcernA document that expresses the https://www.mongodb.com/docs/manual/reference/write-concern/ of the insert command. Omit to use the default write concern.
Nullable!string commentUsers can specify an arbitrary string to help trace the operation through the database profiler, currentOp, and logs.
Fields
Nullable!(Bson[]) arrayFiltersA set of filters specifying to which array elements an update should apply.
Nullable!bool bypassDocumentValidationIf true, allows the write to opt-out of document level validation.
Nullable!Collation collationCollation allows users to specify language-specific rules for string comparison, such as rules for letter-case and accent marks.
Nullable!Bson hintThe index to use. Specify either the index name as a string or the index key pattern.
Nullable!bool upsertWhen true, creates a new document if no document matches the query.
Nullable!WriteConcern writeConcernA document that expresses the https://www.mongodb.com/docs/manual/reference/write-concern/ of the insert command. Omit to use the default write concern.
Nullable!string commentUsers can specify an arbitrary string to help trace the operation through the database profiler, currentOp, and logs.
Fields
Nullable!bool bypassDocumentValidationIf true, allows the write to opt-out of document level validation.
Nullable!Collation collationCollation allows users to specify language-specific rules for string comparison, such as rules for letter-case and accent marks.
Nullable!Bson hintThe index to use. Specify either the index name as a string or the index key pattern.
Nullable!bool upsertWhen true, creates a new document if no document matches the query.
Nullable!WriteConcern writeConcernA document that expresses the https://www.mongodb.com/docs/manual/reference/write-concern/ of the insert command. Omit to use the default write concern.
Nullable!string commentUsers can specify an arbitrary string to help trace the operation through the database profiler, currentOp, and logs.
Fields
Nullable!Collation collationCollation allows users to specify language-specific rules for string comparison, such as rules for letter-case and accent marks.
Nullable!Bson hintThe index to use. Specify either the index name as a string or the index key pattern.
Nullable!WriteConcern writeConcernA document that expresses the https://www.mongodb.com/docs/manual/reference/write-concern/ of the insert command. Omit to use the default write concern.
Nullable!string commentUsers can specify an arbitrary string to help trace the operation through the database profiler, currentOp, and logs.
Nullable!Bson letMap of parameter names and values. Values must be constant or closed expressions that do not reference document fields. Parameters can then be accessed as variables in an aggregate expression conte...
Fields
BsonObjectID insertedIdThe identifier that was automatically generated, if not set.
Fields
BsonObjectID[size_t] insertedIdsThe identifiers that were automatically generated, if not set.
long insertedCountThe number of documents that were inserted.
Fields
long deletedCountThe number of documents that were deleted.
Fields
long matchedCountThe number of documents that matched the filter.
long modifiedCountThe number of documents that were modified.
BsonObjectID[] upsertedIdsThe identifier of the inserted document if an upsert took place. Can be none if no upserts took place, can be multiple if using the updateImpl helper.
Fields
int codeAn integer value identifying the write error.
Bson detailsA document providing more information about the write error (e.g. details pertaining to document validation).
string messageA description of the error.
int indexThe index of the request that errored.

Exception for partially or fully failed writes from insert, update or delete.

Fields
Constructors
this(BulkWriteError[] errors, string file = __FILE__, size_t line = __LINE__, Throwable next = null)

Functions 1

fnvoid handleWriteResult(string countField = null, T)( Bson dbResult, ref T result, string file = __FILE__, size_t line = __LINE__)Handles the raw DB response from `insert`, `update` or `delete` operations.