Expand description
Static operators for queries to prevent invalid queries due to typos.
See mongo manual for query operators and update operators.
If an operator is missing, you can easily add it yourself (also, PR are welcomed) or use the hardcoded string like you would in a mongo shell.
use mongodm::mongo::bson::doc;
use mongodm::operator::*;
// Using static operators
let a = doc! {
And: [
{ "foo": { Exists: true } },
{
Or: [
{ "bar": { GreaterThan: 100 } },
{ "lorem": "ipsum" }
]
}
]
};
// Using hardcoded strings
let b = doc! {
"$and": [
{ "foo": { "$exists": true } },
{
"$or": [
{ "bar": { "$gt": 100 } },
{ "lorem": "ipsum" }
]
}
]
};
// Generated document are identicals
assert_eq!(a, b);
Structs
- Arithmetic Expression Operators operator
$abs
- Trigonometry Expression Operators operator
$acos
- Trigonometry Expression Operators operator
$acosh
- Arithmetic Expression Operators operator
$add
- Aggregation pipeline stages operator
$addFields
- Array (update) operator
$addToSet
- Array (query) operator
$all
- Set Expression Operators operator
$allElementsTrue
- Logical operator
$and
- Set Expression Operators operator
$anyElementTrue
- Array Expression Operators operator
$arrayElemAt
- Array Expression Operators operator
$arrayToObject
- Trigonometry Expression Operators operator
$asin
- Trigonometry Expression Operators operator
$asinh
- Trigonometry Expression Operators operator
$atan
- Trigonometry Expression Operators operator
$atan2
- Trigonometry Expression Operators operator
$atanh
- Accumulators ($group) operator
$avg
- Bitwise (update) operator
$bit
- Bitwise (query) operator
$bitsAllClear
- Bitwise (query) operator
$bitsAllSet
- Bitwise (query) operator
$bitsAnyClear
- Bitwise (query) operator
$bitsAnySet
- Type Expression Operators operator
$type
- Aggregation pipeline stages operator
$bucket
- Aggregation pipeline stages operator
$bucketAuto
- Arithmetic Expression Operators operator
$ceil
- Aggregation pipeline stages operator
$collStatus
- Comments operator
$comment
- Array Expression Operators operator
$cmp
- String Expression Operators operator
$concat
- Array Expression Operators operator
$concatArrays
- Conditional Operators operator
$cond
- Type Expression Operators operator
$convert
- Trigonometry Expression Operators operator
$cos
- Aggregation pipeline stages operator
$count
- Fields operator
$currentDate
- Aggregation pipeline stages operator
$currentOp
- Date Expression Operators operator
$dateFromParts
- Date Expression Operators operator
$dateFromString
- Date Expression Operators operator
$dateToParts
- Date Expression Operators operator
$dateToString
- Date Expression Operators operator
$dayOfMonth
- Date Expression Operators operator
$dayOfWeek
- Date Expression Operators operator
$dayOfYear
- Trigonometry Expression Operators operator
$degreesToRadians
- Arithmetic Expression Operators operator
$divide
- Modifiers operator
$each
- Array (query) operator
$elemMatch
- Comparison operator
$eq
- Element operator
$exists
- Arithmetic Expression Operators operator
$exp
- Evaluation operator
$expr
- Aggregation pipeline stages operator
$facet
- Array Expression Operators operator
$filter
- Aggregation pipeline stages operator
$findAndModify
- Accumulators ($group) operator
$first
- Arithmetic Expression Operators operator
$floor
- Geospatial operator
$geoIntersects
- Aggregation pipeline stages operator
$geoNear
- Geospatial operator
$geoWithin
- Aggregation pipeline stages operator
$graphLookup
- Comparison operator
$gt
- Comparison operator
$gte
- Aggregation pipeline stages operator
$group
- Date Expression Operators operator
$hour
- Conditional Expression Operators operator
$ifNull
- Comparison operator
$in
- Fields operator
$inc
- Array Expression Operators operator
$indexOfArray
- String Expression Operators operator
$indexOfBytes
- String Expression Operators operator
$indexOfCP
- Aggregation pipeline stages operator
$indexStats
- Array Expression Operators operator
$isArray
- Date Expression Operators operator
$isoDayOfWeek
- Date Expression Operators operator
$isoWeek
- Date Expression Operators operator
$isoWeekYear
- Evaluation operator
$jsonSchema
- Accumulators ($group) operator
$last
- String Expression Operators operator
$ltrim
- Comparison operator
$lt
- Comparison operator
$lte
- Variable Expression Operators operator
$let
- Aggregation pipeline stages operator
$limit
- Aggregation pipeline stages operator
$listLocalSessions
- Aggregation pipeline stages operator
$listSessions
- Literal Expression Operator operator
$literal
- Arithmetic Expression Operators operator
$ln
- Arithmetic Expression Operators operator
$log
- Arithmetic Expression Operators operator
$log10
- Lookup Operator operator
$lookup
- Lookup Operator operator
$lookup
- Array Map Operator operator
$map
- Aggregation pipeline stages operator
$match
- Fields operator
$max
- Aggregation pipeline stages operator
$merge
- Object Expression Operators operator
$mergeObjects
- Projection operator
$meta
- Date Expression Operators operator
$millisecond
- Fields operator
$min
- Date Expression Operators operator
$minute
- Evaluation operator
$mod
- Evaluation operator
$mod
- Date Expression Operators operator
$month
- Fields operator
$mul
- Arithmetic Expression Operators operator
$multiply
- Geospatial operator
$near
- Geospatial operator
$nearSphere
- Comparison operator
$nin
- Logical operator
$nor
- Logical operator
$not
- Comparison operator
$ne
- Array Expression Operators operator
$objectToArray
- Logical operator
$or
- Aggregation pipeline stages operator
$out
- Aggregation pipeline stages operator
$planCacheStatus
- Array (update) operator
$pop
- Modifiers operator
$position
- Arithmetic Expression Operators operator
$pow
- Arithmetic Expression Operators operator
$pow
- Aggregation pipeline stages operator
$project
- Projection operator
$
- Array (update) operator
$pull
- Array (update) operator
$pullAll
- Array (update) operator
$push
- Trigonometry Expression Operators operator
$radiansToDegrees
- Array Expression Operators operator
$range
- Aggregation pipeline stages operator
$redact
- Array Expression Operators operator
$reduce
- Evaluation operator
$regex
- String Expression Operators operator
$regexFind
- String Expression Operators operator
$regexFindAll
- String Expression Operators operator
$regexMatch
- Fields operator
$rename
- String Expression Operators operator
$replaceAll
- String Expression Operators operator
$replaceOne
- ReplaceRoot Operator operator
$replaceRoot
- Aggregation pipeline stages operator
$replaceWith
- Array Expression Operators operator
$reverseArray
- String Expression Operators operator
$rtrim
- Arithmetic Expression Operators operator
$round
- Aggregation pipeline stages operator
$sample
- Date Expression Operators operator
$second
- Fields operator
$set
- Set Expression Operators operator
$setDifference
- Set Expression Operators operator
$setEquals
- Set Expression Operators operator
$setIntersection
- Set Expression Operators operator
$setIsSubset
- Fields operator
$setOnInsert
- Set Expression Operators operator
$setUnion
- Trigonometry Expression Operators operator
$sin
- Array (query) operator
$size
- Aggregation pipeline stages operator
$skip
- Projection operator
$slice
- Modifiers operator
$sort
- Aggregation pipeline stages operator
$sortByCount
- String Expression Operators operator
$split
- Arithmetic Expression Operators operator
$sqrt
- Arithmetic Expression Operators operator
$sqrt
- Accumulators ($group) operator
$stdDevPop
- Accumulators ($group) operator
$stdDevSamp
- String Expression Operators operator
$strcasecmp
- String Expression Operators operator
$strLenBytes
- String Expression Operators operator
$substr
- String Expression Operators operator
$substrBytes
- String Expression Operators operator
$substrCP
- Arithmetic Expression Operators operator
$subtract
- Accumulators ($group) operator
$sum
- Conditional Expression Operators operator
$switch
- Trigonometry Expression Operators operator
$tan
- Evaluation operator
$text
- Type Expression Operators operator
$toBool
- Date Expression Operators operator
$toDate
- Type Expression Operators operator
$toDecimal
- Type Expression Operators operator
$toDouble
- Type Expression Operators operator
$toInt
- Type Expression Operators operator
$toLong
- String Expression Operators operator
$toLower
- Type Expression Operators operator
$toObjectId
- String Expression Operators operator
$toString
- String Expression Operators operator
$toUpper
- String Expression Operators operator
$trim
- Arithmetic Expression Operators operator
$trunc
- Arithmetic Expression Operators operator
$truncate
- Element operator
$type
- Fields operator
$unset
- Aggregation pipeline stages operator
$unwind
- Aggregation pipeline stages operator
$update
- Array (update) operator
$[]
- Array (update) operator
$
- Date Expression Operators operator
$week
- Evaluation operator
$where
- Date Expression Operators operator
$year
- Array Expression Operators operator
$zip