Reference

Last updated: 2026-10-09

Reference

Alphabetical list of 311 MongoDB items with descriptions.

#
$eq$eq selects documents where the field value equals the specified value. It is MongoDB's mo...
$ne$ne selects documents where the field value does not equal the specified value — the negat...
$in$in selects documents where the field value equals any value in a given array — a convenie...
$set$set assigns (or overwrites) the value of one or more fields in a document. It creates the...
$inc$inc increases (or decreases) a numeric field by a specified amount, creating the field wi...
$gt$gt selects documents where a field value is strictly greater than the specified value. `{...
$gte$gte selects documents where a field value is greater than or equal to the specified value...
$lt$lt selects documents where a field value is strictly less than the specified value. `{ pr...
$lte$lte selects documents where a field value is less than or equal to the specified value. `...
$nin$nin selects documents where the field value does not equal any value in the given array —...
$and$and combines multiple query predicates; a document must satisfy all of them. `{ $and: [ {...
$or$or combines query predicates; a document matches if it satisfies any of them. `{ $or: [ {...
$not$not negates an operator expression, returning documents that fail the inner condition. `{...
$nor$nor combines predicates; a document matches only when none of them hold. `{ $nor: [ { pri...
$exists$exists filters documents by whether a field is present. `{ $exists: true }` matches docum...
$type$type matches documents where a field value is of a given BSON type. `{ age: { $type: 'int...
$regex$regex matches string fields with a regular expression. `{ name: { $regex: '^A' } }` match...
$jsonSchema$jsonSchema validates document structure against the JSON Schema draft standard, usable as...
$expr$expr lets query predicates use aggregation expressions — comparing multiple fields of the...
$text$text runs full-text search on fields covered by a text index. `{ $text: { $search: 'coffe...
$where$where evaluates a JavaScript expression as the query predicate. `{ $where: 'this.credits ...
$mod$mod matches documents where the field value divided by a divisor leaves a specified remai...
$all$all matches documents whose array field contains every element of the given array. `{ tag...
$elemMatch$elemMatch matches documents where at least one array element satisfies all the given cond...
$size$size matches documents where an array field has exactly the given length. `{ tags: { $siz...
$geoWithin$geoWithin finds documents whose location falls inside a given geometry: $box (rectangle),...
$geoIntersects$geoIntersects finds documents whose GeoJSON geometry intersects the given geometry. `{ lo...
$near$near returns geospatial documents ordered by distance from a point, ascending. `{ loc: { ...
$nearSphere$nearSphere returns geospatial documents ordered by spherical (great-circle) distance. `{ ...
$bitsAllSet$bitsAllSet matches documents where all bits at the given positions are set to 1. `{ flags...
$bitsAllClear$bitsAllClear matches documents where all bits at the given positions are 0. `{ flags: { $...
$bitsAnySet$bitsAnySet matches documents where at least one of the bits at the given positions is 1. ...
$bitsAnyClear$bitsAnyClear matches documents where at least one of the bits at the given positions is 0...
$meta$meta projects metadata from a $text search, most commonly the relevance score textScore. ...
$slice$slice in a projection returns a subset of an array field without modifying the document. ...
$natural$natural returns documents in the collection's physical storage order. `{ $natural: 1 }` f...
$comment$comment attaches explanatory text to a query so you can trace its origin in currentOp, th...
$currentDate$currentDate sets a field to the current time as a Date or Timestamp. `{ $currentDate: { l...
$min$min writes the given value only when it is smaller than the current field value, leaving ...
$max$max writes the given value only when it is larger than the current field value. `{ $max: ...
$mul$mul multiplies a field value by the given factor. `{ $mul: { price: 0.9 } }` applies a 10...
$rename$rename renames a field. `{ $rename: { 'oldName': 'newName' } }`, with dotted paths for ne...
$setOnInsert$setOnInsert sets field values only when an upsert inserts a new document; it is ignored w...
$unset$unset removes the specified field from a document. `{ $unset: { age: '' } }` — the value ...
$addToSet$addToSet adds a value to an array only if it is not already present, keeping the array fr...
$pop$pop removes the first (-1) or last (1) element of an array. `{ $pop: { queue: -1 } }` rem...
$pull$pull removes from an array every element that equals a value or satisfies a condition. `{...
$push$push appends one or more elements to the end of an array. `{ $push: { items: 'pen' } }`; ...
$pullAll$pullAll removes from an array every element equal to any value in the given list. `{ $pul...
$bit$bit performs bitwise operations on integer fields: AND, OR, XOR. `{ $bit: { flags: { and:...
$position$position sets where $push inserts elements. `{ $push: { items: { $each: ['x'], $position:...
$[]$[] is the positional operator that updates every element of an array. `{ $set: { 'grades....
$[]$[identifier] is the positional operator that, together with arrayFilters, updates only th...
$each$each supplies multiple values to $push and $addToSet. `{ $push: { tags: { $each: ['a', 'b...
$slice$slice as an update modifier caps an array's length after $push. `{ $push: { log: { $each:...
$sort$sort as an update modifier orders array elements after $push. `{ $push: { scores: { $each...
$match$match filters documents with a query condition, passing only matching documents to subseq...
$group$group groups documents by a specified key (_id) and applies accumulator expressions ($sum...
$lookup$lookup performs a left outer join between the current collection and another collection, ...
$sum$sum is an accumulator computing the total of a specified field across a group (or a count...
$project$project is the projection stage: it selects or excludes fields, or computes new ones, map...
$unwind$unwind deconstructs an array field, emitting one document per element while copying all o...
$sort$sort orders pipeline documents by specified fields: 1 ascending, -1 descending, with mult...
$limit$limit truncates the pipeline to the first N documents in the current order, changing only...
$skip$skip drops the first N documents in the pipeline's current order and passes the rest unch...
$count$count returns a single document shaped like { field: N } holding the number of documents ...
$addFields$addFields adds new fields to, or overwrites existing fields in, each document while prese...
$set$set is an alias of $addFields: it adds or overwrites fields on each document while keepin...
$replaceRoot$replaceRoot replaces the entire document with a specified embedded document, commonly use...
$replaceWith$replaceWith is like $replaceRoot but tolerates null or missing expression results, keepin...
$sample$sample randomly selects a specified number of documents — handy for sampling analysis, te...
$documents$documents returns a given array of literal documents without reading any collection — a l...
$sortByCount$sortByCount is shorthand for $group plus $sort: it groups by an expression's value, count...
$unset$unset removes specified fields from documents, keeping everything else. It is shorthand f...
$bucket$bucket groups documents into buckets defined by an ascending boundaries array, emitting o...
$bucketAuto$bucketAuto distributes documents into a specified number of buckets with roughly equal co...
$densify$densify generates documents at missing intermediate field values, typically for time-seri...
$setWindowFields$setWindowFields performs window computations — ranks, moving averages, running totals — o...
$facet$facet runs multiple sub-pipelines in parallel within one stage, each processing the same ...
$geoNear$geoNear outputs documents ordered by geographic proximity and must be the first pipeline ...
$graphLookup$graphLookup performs recursive searches on a collection, emulating graph traversal: start...
$merge$merge writes pipeline results into a target collection (possibly another database or clus...
$out$out writes pipeline results to a named collection, replacing all of its previous contents...
$unionWith$unionWith merges the pipeline's accumulated results with documents from another collectio...
$redact$redact filters at field level using permission metadata stored in documents, with the sys...
$collStats$collStats returns storage statistics for the collection — document count, data size, inde...
$indexStats$indexStats returns usage statistics per index — name, access count, misses, and last-use ...
$avg$avg is an accumulator computing the average of a field across a group in $group, or the a...
$max$max is an accumulator returning the maximum value of a field across a group in $group, or...
$min$min is an accumulator returning the minimum value of a field across a group in $group, or...
$push$push is an accumulator appending each document's expression result to an array during $gr...
$addToSet$addToSet is an accumulator that adds each document's expression result to an array during...
$first$first is an accumulator returning a field from the first document of a group. It depends ...
$last$last is an accumulator returning a field from the last document of a group — symmetric to...
$stdDevPop$stdDevPop is an accumulator computing the population standard deviation of a field across...
$stdDevSamp$stdDevSamp is an accumulator computing the sample standard deviation of a field across a ...
$top$top is an accumulator returning the top document of a group per a specified sort order — ...
$topN$topN is an accumulator returning the N top documents (or expression values) per group by ...
$bottom$bottom is an accumulator returning the bottom document of a group per a specified sort or...
$bottomN$bottomN is an accumulator returning the N bottom documents (or expression values) per gro...
$count$count is an accumulator counting documents within a $group, available since MongoDB 5.0. ...
$firstN$firstN is an accumulator returning an array of a field's values from the first N document...
$lastN$lastN is an accumulator returning an array of a field's values from the last N documents ...
$maxN$maxN is an accumulator returning an array of the N largest distinct values of a field in ...
$minN$minN is an accumulator returning an array of the N smallest distinct values of a field in...
$accumulator$accumulator defines custom accumulator logic with JavaScript callbacks — init, accumulate...
$median$median is an accumulator returning the median of a numeric field within a group, availabl...
$percentile$percentile is an accumulator returning values at given percentiles (0 to 100) of a field ...
$concatArrays$concatArrays merges multiple arrays into one without deduplication. As an array expressio...
$setUnion$setUnion returns the union of two or more arrays, deduplicated, with no guaranteed elemen...
$concat$concat joins two or more strings (or expressions resolving to strings) into one string. I...
$toUpper$toUpper converts a string to uppercase. It is the simplest string transformation operator...
$dateToString$dateToString formats a date into a string using a format pattern — the standard way to ou...
$add$add performs addition inside aggregation expressions. It adds multiple numbers together, ...
$subtract$subtract performs subtraction in aggregation expressions, the counterpart of $add. It tak...
$multiply$multiply computes the product of multiple numeric values in aggregation expressions. Argu...
$divide$divide performs division in aggregation expressions with two arguments: the dividend and ...
$mod$mod returns the remainder of dividing two values in aggregation expressions. It takes two...
$abs$abs returns the absolute value of a single numeric expression. It is commonly used to com...
$ceil$ceil returns the smallest integer greater than or equal to a given number — rounding up. ...
$floor$floor returns the largest integer less than or equal to a given number — rounding down. I...
$ln$ln returns the natural logarithm (base e) of a number. It is used for growth-rate calcula...
$log$log returns the logarithm of a number with a specified base. It takes two arguments: the ...
$log10$log10 returns the base-10 logarithm of a number. It is used for order-of-magnitude checks...
$log2$log2 returns the base-2 logarithm of a number, used in computing contexts such as binary-...
$pow$pow raises a number to a power. It takes two arguments — the base and the exponent — retu...
$sqrt$sqrt returns the square root of a single numeric expression. It is used in geometry, stan...
$exp$exp returns e raised to the given power, the exponential function e to the power of x, wh...
$round$round rounds a number, optionally to a specified decimal place. It takes the value and an...
$trunc$trunc truncates the fractional part of a number toward zero, optionally keeping a specifi...
$sign$sign returns the sign of a number: 1 for positives, -1 for negatives, and 0 for zero. It ...
$sin$sin returns the sine of a value expressed in radians. It is used for periodic signal proc...
$cos$cos returns the cosine of a value expressed in radians. It is used for vector projection,...
$tan$tan returns the tangent of a value expressed in radians. It is used for slope calculation...
$asin$asin returns the arcsine of a number, with the result expressed in radians. The input mus...
$acos$acos returns the arccosine of a number, with the result in radians and the input restrict...
$atan$atan returns the arctangent of a number in radians, accepting any real input. It is used ...
$atan2$atan2 returns the bearing angle in radians from a y coordinate and an x coordinate, takin...
$degreesToRadians$degreesToRadians converts degrees to radians by multiplying by π/180. Since the trigonome...
$radiansToDegrees$radiansToDegrees converts radians to degrees by multiplying by 180/π. The inverse trigono...
$bitAnd$bitAnd performs a bitwise AND on integers. Available since MongoDB 6.3, it accepts an arr...
$bitOr$bitOr performs a bitwise OR on integers. Available since MongoDB 6.3, it accepts an array...
$bitXor$bitXor performs a bitwise XOR on integers. Available since MongoDB 6.3, it accepts an arr...
$bitNot$bitNot performs a bitwise NOT (two's complement) on a single integer — the only bitwise o...
$dateAdd$dateAdd adds a specified amount of a time unit to a date and returns the new date — the g...
$dateSubtract$dateSubtract subtracts a specified amount of a time unit from a date and returns the new ...
$dateFromParts$dateFromParts builds a date from numeric parts such as year, month, day, hour, minute, se...
$dateToParts$dateToParts splits a date into a document of year, month, day, hour, minute, second, and ...
$dateDiff$dateDiff computes the difference between two dates in a given unit as an integer — ideal ...
$dateTrunc$dateTrunc truncates a date to the start of a given unit and returns the new date — perfec...
$dateFromString$dateFromString parses a string into a date using a given format — the inverse of $dateToS...
$dayOfMonth$dayOfMonth returns the day of month of a date (1 to 31) — a common expression for day-lev...
$dayOfWeek$dayOfWeek returns the weekday of a date as an integer: 1 is Sunday, 7 is Saturday — match...
$dayOfYear$dayOfYear returns the day of the year of a date (1 to 366) — useful for yearly progress, ...
$isoDayOfWeek$isoDayOfWeek returns the weekday number per ISO 8601: 1 is Monday, 7 is Sunday — unlike $...
$isoWeek$isoWeek returns the ISO 8601 week number of a date (1 to 53). ISO weeks start on Monday, ...
$isoWeekYear$isoWeekYear returns the year to which a date's ISO week belongs, used with $isoWeek. Beca...
$millisecond$millisecond returns the millisecond part of a date (0 to 999) — a fine-grained time extra...
$minute$minute returns the minute part of a date (0 to 59) — common for minute-granularity traffi...
$month$month returns the month of a date (1 to 12) — one of the most-used expressions for monthl...
$second$second returns the second part of a date (0 to 59) — useful for second-level labels or ti...
$week$week returns the US-style week number of a date (0 to 53): weeks start on Sunday, week 1 ...
$year$year returns the full year of a date (e.g. 2026) — the most basic date extractor. It ofte...
$hour$hour returns the hour part of a date (0 to 23) — common for hourly traffic analysis, aler...
$split$split breaks a string into an array of substrings by a delimiter — a staple for CSV-ish t...
$strcasecmp$strcasecmp compares two strings case-insensitively and returns -1, 0, or 1 — handy for so...
$substr$substr extracts a substring starting at a given position with a given length. Since Mongo...
$substrBytes$substrBytes extracts a substring by UTF-8 byte positions; both start and length count byt...
$substrCP$substrCP extracts a substring counting positions in Unicode code points (roughly characte...
$regexFind$regexFind runs a Perl-compatible regex search on a string and returns the first match as ...
$regexFindAll$regexFindAll runs a regex search on a string and returns every match as an array; each el...
$regexMatch$regexMatch tests whether a string matches a regex and returns true or false — the lightes...
$regexReplace$regexReplace matches text with a regex and replaces it with a given string — an advanced ...
$indexOfBytes$indexOfBytes returns the UTF-8 byte index of the first occurrence of a substring, or -1 w...
$indexOfCP$indexOfCP returns the code-point (character) index of the first occurrence of a substring...
$trim$trim removes whitespace (spaces, tabs, newlines) from both ends of a string, or strips a ...
$ltrim$ltrim strips whitespace, or characters in the given chars set, from the left (start) of a...
$rtrim$rtrim strips whitespace, or characters in the given chars set, from the right (end) of a ...
$toLower$toLower converts a string to lowercase — a fundamental normalization operator. It is used...
$strLenBytes$strLenBytes returns the UTF-8 byte length of a string — a staple for storage estimation a...
$strLenCP$strLenCP returns the number of Unicode code points in a string — essentially the characte...
$replaceOne$replaceOne replaces the first occurrence of a substring in a string with a given replacem...
$replaceAll$replaceAll replaces every occurrence of a substring with a given string — ideal for batch...
$binarySize$binarySize returns the byte size of binary data (BinData); given a string it returns the ...
$arrayElemAt$arrayElemAt returns the element at a given index position in an array. It is the core ope...
$concatArrays$concatArrays merges two or more arrays into a single new array. It is commonly used to co...
$filter$filter walks an array, keeps the elements that satisfy a condition, and returns a new arr...
$indexOfArray$indexOfArray returns the index of the first occurrence of a value in an array, or -1 when...
$isArray$isArray returns a boolean indicating whether an expression resolves to an array. It is fr...
$map$map iterates an array, passes every element through the in expression, and collects the r...
$size$size returns the number of elements in an array as a non-negative integer. It is the most...
$slice$slice extracts a portion of an array. It supports two forms: the two-argument form takes ...
$reduce$reduce folds an array into a single value, the aggregation equivalent of functional reduc...
$reverseArray$reverseArray reverses the order of elements in an array and returns a new array. Typical ...
$sortArray$sortArray sorts the elements inside an array and is new in MongoDB 5.2. Scalar arrays use...
$objectToArray$objectToArray converts a document into an array of key-value pairs, each element shaped l...
$arrayToObject$arrayToObject converts an array of key-value pairs back into a document, the inverse of $...
$range$range produces a sequence of integers from a start value up to (but excluding) an end val...
$zip$zip merges several arrays by position into groups, each holding the element at the same i...
$allElementsTrue$allElementsTrue returns true only if every element of an array is truthy. An empty array ...
$anyElementTrue$anyElementTrue returns true when at least one element of an array is truthy. An empty arr...
$setDifference$setDifference returns elements present in the first array but absent from the second, wit...
$setEquals$setEquals checks whether two or more arrays are equal as sets, ignoring order and duplica...
$setIntersection$setIntersection returns the elements present in every input array, with duplicates remove...
$setIsSubset$setIsSubset checks whether every element of the first array also appears in the second — ...
$setUnion$setUnion merges all input arrays and deduplicates the elements, returning the union. Typi...
$cond$cond implements if-then-else ternary logic, the most basic branching operator in aggregat...
$ifNull$ifNull returns a replacement value when an expression resolves to null or a field is miss...
$switch$switch evaluates multiple case branches in order and returns the then result of the first...
$convert$convert casts a value to a target BSON type and is the master entry point for type conver...
$toBool$toBool converts a value to a boolean. The number 0 becomes false and any non-zero number ...
$toDate$toDate converts a value to a BSON Date. It passes dates through, treats numbers as millis...
$toDecimal$toDecimal converts a value to Decimal128, the high-precision decimal type for money and o...
$toDouble$toDouble converts a value to a BSON double. It accepts numbers, numeric strings, booleans...
$toInt$toInt converts a value to a 32-bit signed integer (BSON int). It accepts numbers, numeric...
$toLong$toLong converts a value to a 64-bit signed integer (BSON long), with a far wider range th...
$toObjectId$toObjectId converts a 24-character hexadecimal string into an ObjectId, the most common c...
$toString$toString converts a value to a string. Numbers, dates, booleans, ObjectIds and more conve...
$cmp$cmp compares two values and returns -1, 0, or 1 for less than, equal, or greater than. It...
$eq$eq is the expression-form equality comparison, taking two arguments and returning a boole...
$gt$gt is the expression-form greater-than comparison. It takes two arguments and returns tru...
$gte$gte is the expression-form greater-than-or-equal comparison. It takes two arguments and r...
$lt$lt is the expression-form less-than comparison. It takes two arguments and returns true w...
$lte$lte is the expression-form less-than-or-equal comparison. It takes two arguments and retu...
$ne$ne is the expression-form inequality comparison. It takes two arguments and returns true ...
$literal$literal returns a value without parsing it as an expression. It is used when a string sta...
$let$let defines local variables inside aggregation expressions for use in the in expression, ...
$getField$getField fetches a field by its literal name from a document, without parsing the name as...
$setField$setField adds or updates a named field in a document and returns a new document without m...
A
aggregate()aggregate() runs a multi-stage pipeline that groups, computes, and reshapes documents, e.g...
allowDiskUse()allowDiskUse() lets a cursor spill to disk for blocking operations like sort() that demand...
ArrayArray holds an ordered list of any BSON values (including nested arrays and documents). Ma...
B
bulkWrite()bulkWrite() executes several write operations of mixed types in a single call: insertOne, ...
batchSize()batchSize() sets how many documents the cursor pulls from the server per batch: `db.users....
BooleanBoolean holds true or false — ideal for flags and toggles (isActive, isDeleted). Query by ...
BinaryBinary stores images, files, encrypted data, and UUIDs — more compact than Base64 strings,...
C
countDocuments()countDocuments() counts documents matching a filter, e.g. `db.users.countDocuments({ age: ...
createIndex()createIndex() builds a single index to speed up queries, e.g. `db.users.createIndex({ age:...
createIndexes()createIndexes() creates several indexes in one call, e.g. `db.users.createIndexes([{ key: ...
count()count() counts the documents the current cursor would return: `db.users.find({ age: { $gt:...
collation()collation() sets string comparison rules for a query: `db.users.find({ name: 'alice' }).co...
close()close() shuts down a cursor early and frees server-side resources: `db.users.find().close(...
currentOpcurrentOp lists operations currently executing, for diagnosing slow queries and long-runni...
collModcollMod adjusts settings of an existing collection: TTL index expiry (expireAfterSeconds),...
createIndexescreateIndexes builds indexes on a collection — single-field, compound, unique, TTL, text, ...
createUsercreateUser creates a database user with roles; in mongosh use db.createUser({ user, pwd, r...
D
deleteOne()deleteOne() removes the first document matching a filter; if several match, only the first...
deleteMany()deleteMany() removes every document matching a filter and returns deletedCount. It is the ...
distinct()distinct() returns every unique value of a given field in the collection, e.g. `db.users.d...
dropIndex()dropIndex() removes a specific index, accepting its name or key, e.g. `db.users.dropIndex(...
dropIndexes()dropIndexes() removes one or more indexes, e.g. `db.users.dropIndexes()` drops every non-_...
drop()drop() removes an entire collection — all documents, indexes, and metadata, e.g. `db.users...
DateDate is MongoDB's date-time type, stored internally as a 64-bit millisecond count since th...
Decimal128Decimal128 is MongoDB's high-precision decimal type, based on the IEEE 754-2008 decimal fl...
DoubleDouble is MongoDB's default numeric type: a 64-bit IEEE 754 float, roughly ±1.8×10^308. Ba...
dropUserdropUser deletes a user from the database. The user can no longer authenticate immediately...
dbStatsdbStats returns current-database statistics — collection count, document count, data size,...
E
estimatedDocumentCount()estimatedDocumentCount() estimates the total document count from collection metadata, e.g....
explain()explain() reveals a query's execution plan: `db.users.find({ age: { $gt: 20 } }).explain('...
F
find()find() queries documents matching a condition and returns a Cursor. It is the most basic r...
findOneAndUpdate()findOneAndUpdate() updates the first document matching a filter and returns the document i...
findOneAndDelete()findOneAndDelete() removes the first document matching a filter and returns the removed do...
findOneAndReplace()findOneAndReplace() swaps the first document matching a filter for a replacement document ...
findOne()findOne() returns the first document matching a filter directly as a document, not a curso...
forEach()forEach() runs a callback on every document in a cursor, e.g. `db.users.find().forEach(fun...
findfind is MongoDB's query command. mongosh normally uses the helper db.collection.find(filte...
G
getIndexes()getIndexes() returns all indexes of a collection, e.g. `db.users.getIndexes()`. Each entry...
grantRolesToUsergrantRolesToUser appends roles to an existing user — incremental, keeping all current role...
H
hasNext()hasNext() reports whether a cursor still has a next document: `while (db.users.find().hasN...
hint()hint() forces a query to use a specific index: `db.users.find({ age: { $gt: 20 } }).hint({...
I
insertOne()insertOne() inserts a single document into a collection. If the document has no _id, Mongo...
insertMany()insertMany() inserts multiple documents in one call, e.g. `db.users.insertMany([{ name: 'A...
indexStats()indexStats() reports per-index usage statistics, e.g. `db.users.indexStats()` — access cou...
Int32Int32 is a signed 32-bit integer, ranging from -2147483648 to 2147483647. In mongosh a bar...
insertinsert is the low-level insertion command, normally wrapped by db.collection.insertOne()/i...
J
JavaScriptThe JavaScript type stores JS code in a document, executed server-side through `$where` (r...
L
limit()limit() caps how many documents find() returns: `db.users.find({ age: { $gt: 20 } }).limit...
LongLong is a signed 64-bit integer (BSON type int64), roughly ±9.2×10^18, constructed with `L...
logoutlogout ends the authentication session of the current connection, signing the user out; in...
listCollectionslistCollections lists the database's collections with their options (validator, collation,...
M
map()map() applies a transform to every document in a cursor and returns the results as an arra...
maxTimeMS()maxTimeMS() caps how long a cursor operation may run, in milliseconds: `db.users.find().ma...
MinKeyMinKey is a special BSON type smaller than every other value, opposite to MaxKey. It serve...
MaxKeyMaxKey is a special BSON type larger than every other value, the counterpart of MinKey. It...
N
next()next() returns the next document in a cursor and advances it: `db.users.find().next()`. Ca...
noCursorTimeout()noCursorTimeout() disables a cursor's server-side idle timeout: `db.users.find().noCursorT...
NullNull means the field holds an empty value, distinct from a missing field. A query like `{ ...
O
ObjectIdObjectId is MongoDB's default _id type — a 12-byte unique identifier: 4-byte timestamp + 5...
Object (Document)Object is a nested subdocument. MongoDB nests arbitrarily deep for self-describing models....
P
pingping verifies the MongoDB server is reachable and responsive, returning { ok: 1 } on succe...
profileprofile toggles the Database Profiler: level 0 off, 1 records only slow operations (past s...
R
replaceOne()replaceOne() swaps the first document matching a filter for an entirely new document. Unli...
renameCollection()renameCollection() renames a collection, e.g. `db.users.renameCollection('members')`. Data...
Regular ExpressionRegular Expression is a BSON type for pattern matching in queries, equivalent to `{ field:...
runCommand()db.runCommand() executes any database command in mongosh — the generic entry point for low...
renameCollectionrenameCollection renames a collection within or across databases and must run against the ...
revokeRolesFromUserrevokeRolesFromUser removes the listed roles from a user while keeping the rest. Revocatio...
S
stats()stats() returns collection statistics, e.g. `db.users.stats()` — document count, collectio...
skip()skip() discards the first N documents of a cursor: `db.users.find().sort({ age: 1 }).skip(...
sort()sort() orders cursor results by given fields: `db.users.find().sort({ age: 1, name: -1 })`...
size()size() returns the number of documents in a cursor: `db.users.find().size()`. Its semantic...
StringString is MongoDB's most common field type, holding UTF-8 text. Match exactly with `$eq` o...
T
toArray()toArray() fetches everything a find()-style cursor references and returns it as a JavaScri...
tailable()tailable() marks a cursor as tailable, e.g. `db.logs.find().tailable()`. Instead of closin...
tryNext()tryNext() attempts to return the next cursor document, yielding null instead of throwing a...
TimestampTimestamp is an internal MongoDB type: a 64-bit value made of a 4-byte Unix second plus a ...
U
updateOne()updateOne() updates the first document matching a filter. If multiple match, only the firs...
updateMany()updateMany() updates every document matching a filter, e.g. `db.users.updateMany({ age: { ...
updateUserupdateUser modifies an existing user: reset the password, replace roles, or refresh custom...
V
validate()validate() checks a collection's structural integrity, e.g. `db.users.validate({ full: tru...
W
watch()watch() monitors a collection for changes and returns a Change Stream, e.g. `db.users.watc...
Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏