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ยง
- Abs
-
Arithmetic Expression Operators
operator
$abs
- Acos
-
Trigonometry Expression Operators
operator
$acos
- Acosh
-
Trigonometry Expression Operators
operator
$acosh
- Add
-
Arithmetic Expression Operators
operator
$add
- AddFields
-
Aggregation pipeline stages
operator
$addFields
- AddTo
Set -
Array (update)
operator
$addToSet
- All
-
Array (query)
operator
$all
- AllElements
True -
Set Expression Operators
operator
$allElementsTrue
- And
-
Logical
operator
$and
- AnyElement
True -
Set Expression Operators
operator
$anyElementTrue
- Array
Elem At -
Array Expression Operators
operator
$arrayElemAt
- Array
ToObject -
Array Expression Operators
operator
$arrayToObject
- Asin
-
Trigonometry Expression Operators
operator
$asin
- Asinh
-
Trigonometry Expression Operators
operator
$asinh
- Atan
-
Trigonometry Expression Operators
operator
$atan
- Atan2
-
Trigonometry Expression Operators
operator
$atan2
- Atanh
-
Trigonometry Expression Operators
operator
$atanh
- Average
-
Accumulators ($group)
operator
$avg
- Bit
-
Bitwise (update)
operator
$bit
- Bits
AllClear -
Bitwise (query)
operator
$bitsAllClear
- Bits
AllSet -
Bitwise (query)
operator
$bitsAllSet
- Bits
AnyClear -
Bitwise (query)
operator
$bitsAnyClear
- Bits
AnySet -
Bitwise (query)
operator
$bitsAnySet
- Bson
Type -
Type Expression Operators
operator
$type
- Bucket
-
Aggregation pipeline stages
operator
$bucket
- Bucket
Auto -
Aggregation pipeline stages
operator
$bucketAuto
- Ceil
-
Arithmetic Expression Operators
operator
$ceil
- Coll
Stats -
Aggregation pipeline stages
operator
$collStatus
- Comment
-
Comments
operator
$comment
- Compare
-
Array Expression Operators
operator
$cmp
- Concat
-
String Expression Operators
operator
$concat
- Concat
Arrays -
Array Expression Operators
operator
$concatArrays
- Cond
-
Conditional Operators
operator
$cond
- Convert
-
Type Expression Operators
operator
$convert
- Cos
-
Trigonometry Expression Operators
operator
$cos
- Count
-
Aggregation pipeline stages
operator
$count
- Current
Date -
Fields
operator
$currentDate
- Current
Op -
Aggregation pipeline stages
operator
$currentOp
- Date
From Parts -
Date Expression Operators
operator
$dateFromParts
- Date
From String -
Date Expression Operators
operator
$dateFromString
- Date
ToParts -
Date Expression Operators
operator
$dateToParts
- Date
ToString -
Date Expression Operators
operator
$dateToString
- DayOf
Month -
Date Expression Operators
operator
$dayOfMonth
- DayOf
Week -
Date Expression Operators
operator
$dayOfWeek
- DayOf
Year -
Date Expression Operators
operator
$dayOfYear
- Degrees
ToRadians -
Trigonometry Expression Operators
operator
$degreesToRadians
- Divide
-
Arithmetic Expression Operators
operator
$divide
- Each
-
Modifiers
operator
$each
- Elem
Match -
Array (query)
operator
$elemMatch
- Equal
-
Comparison
operator
$eq
- Exists
-
Element
operator
$exists
- Exp
-
Arithmetic Expression Operators
operator
$exp
- Expr
-
Evaluation
operator
$expr
- Facet
-
Aggregation pipeline stages
operator
$facet
- Filter
-
Array Expression Operators
operator
$filter
- Find
AndModify -
Aggregation pipeline stages
operator
$findAndModify
- First
-
Accumulators ($group)
operator
$first
- Floor
-
Arithmetic Expression Operators
operator
$floor
- GeoIntersects
-
Geospatial
operator
$geoIntersects
- GeoNear
-
Aggregation pipeline stages
operator
$geoNear
- GeoWithin
-
Geospatial
operator
$geoWithin
- Graph
Lookup -
Aggregation pipeline stages
operator
$graphLookup
- Greater
Than -
Comparison
operator
$gt
- Greater
Than Equal -
Comparison
operator
$gte
- Group
-
Aggregation pipeline stages
operator
$group
- Hour
-
Date Expression Operators
operator
$hour
- IfNull
-
Conditional Expression Operators
operator
$ifNull
- In
-
Comparison
operator
$in
- Inc
-
Fields
operator
$inc
- Index
OfArray -
Array Expression Operators
operator
$indexOfArray
- Index
OfBytes -
String Expression Operators
operator
$indexOfBytes
- Index
OfCp -
String Expression Operators
operator
$indexOfCP
- Index
Stats -
Aggregation pipeline stages
operator
$indexStats
- IsArray
-
Array Expression Operators
operator
$isArray
- IsoDay
OfWeek -
Date Expression Operators
operator
$isoDayOfWeek
- IsoWeek
-
Date Expression Operators
operator
$isoWeek
- IsoWeek
Year -
Date Expression Operators
operator
$isoWeekYear
- Json
Schema -
Evaluation
operator
$jsonSchema
- Last
-
Accumulators ($group)
operator
$last
- Left
Trim -
String Expression Operators
operator
$ltrim
- Lesser
Than -
Comparison
operator
$lt
- Lesser
Than Equal -
Comparison
operator
$lte
- Let
-
Variable Expression Operators
operator
$let
- Limit
-
Aggregation pipeline stages
operator
$limit
- List
Local Sessions -
Aggregation pipeline stages
operator
$listLocalSessions
- List
Sessions -
Aggregation pipeline stages
operator
$listSessions
- Literal
-
Literal Expression Operator
operator
$literal
- Ln
-
Arithmetic Expression Operators
operator
$ln
- Log
-
Arithmetic Expression Operators
operator
$log
- Log10
-
Arithmetic Expression Operators
operator
$log10
- Lookup
-
Lookup Operator
operator
$lookup
- Lookup
Pipeline -
Lookup Operator
operator
$lookup
- Map
-
Array Map Operator
operator
$map
- Match
-
Aggregation pipeline stages
operator
$match
- Max
-
Fields
operator
$max
- Merge
-
Aggregation pipeline stages
operator
$merge
- Merge
Objects -
Object Expression Operators
operator
$mergeObjects
- Meta
-
Projection
operator
$meta
- Millisecond
-
Date Expression Operators
operator
$millisecond
- Min
-
Fields
operator
$min
- Minute
-
Date Expression Operators
operator
$minute
- Mod
-
Evaluation
operator
$mod
- Modulo
-
Evaluation
operator
$mod
- Month
-
Date Expression Operators
operator
$month
- Mul
-
Fields
operator
$mul
- Multiply
-
Arithmetic Expression Operators
operator
$multiply
- Near
-
Geospatial
operator
$near
- Near
Sphere -
Geospatial
operator
$nearSphere
- NoneIn
-
Comparison
operator
$nin
- Nor
-
Logical
operator
$nor
- Not
-
Logical
operator
$not
- NotEqual
-
Comparison
operator
$ne
- Object
ToArray -
Array Expression Operators
operator
$objectToArray
- Or
-
Logical
operator
$or
- Out
-
Aggregation pipeline stages
operator
$out
- Plan
Cache Stats -
Aggregation pipeline stages
operator
$planCacheStatus
- Pop
-
Array (update)
operator
$pop
- Position
-
Modifiers
operator
$position
- Pow
-
Arithmetic Expression Operators
operator
$pow
- Power
-
Arithmetic Expression Operators
operator
$pow
- Project
-
Aggregation pipeline stages
operator
$project
- Project
First -
Projection
operator
$
- Pull
-
Array (update)
operator
$pull
- PullAll
-
Array (update)
operator
$pullAll
- Push
-
Array (update)
operator
$push
- Radians
ToDegrees -
Trigonometry Expression Operators
operator
$radiansToDegrees
- Range
-
Array Expression Operators
operator
$range
- Redact
-
Aggregation pipeline stages
operator
$redact
- Reduce
-
Array Expression Operators
operator
$reduce
- Regex
-
Evaluation
operator
$regex
- Regex
Find -
String Expression Operators
operator
$regexFind
- Regex
Find All -
String Expression Operators
operator
$regexFindAll
- Regex
Match -
String Expression Operators
operator
$regexMatch
- Rename
-
Fields
operator
$rename
- Replace
All -
String Expression Operators
operator
$replaceAll
- Replace
One -
String Expression Operators
operator
$replaceOne
- Replace
Root -
ReplaceRoot Operator
operator
$replaceRoot
- Replace
With -
Aggregation pipeline stages
operator
$replaceWith
- Reverse
Array -
Array Expression Operators
operator
$reverseArray
- Right
Trim -
String Expression Operators
operator
$rtrim
- Round
-
Arithmetic Expression Operators
operator
$round
- Sample
-
Aggregation pipeline stages
operator
$sample
- Second
-
Date Expression Operators
operator
$second
- Set
-
Fields
operator
$set
- SetDifference
-
Set Expression Operators
operator
$setDifference
- SetEquals
-
Set Expression Operators
operator
$setEquals
- SetIntersection
-
Set Expression Operators
operator
$setIntersection
- SetIs
Subset -
Set Expression Operators
operator
$setIsSubset
- SetOn
Insert -
Fields
operator
$setOnInsert
- SetUnion
-
Set Expression Operators
operator
$setUnion
- Sin
-
Trigonometry Expression Operators
operator
$sin
- Size
-
Array (query)
operator
$size
- Skip
-
Aggregation pipeline stages
operator
$skip
- Slice
-
Projection
operator
$slice
- Sort
-
Modifiers
operator
$sort
- Sort
ByCount -
Aggregation pipeline stages
operator
$sortByCount
- Split
-
String Expression Operators
operator
$split
- Sqrt
-
Arithmetic Expression Operators
operator
$sqrt
- Square
Root -
Arithmetic Expression Operators
operator
$sqrt
- StdDev
Pop -
Accumulators ($group)
operator
$stdDevPop
- StdDev
Samp -
Accumulators ($group)
operator
$stdDevSamp
- StrCase
Cmp -
String Expression Operators
operator
$strcasecmp
- StrLen
Bytes -
String Expression Operators
operator
$strLenBytes
- Substr
-
String Expression Operators
operator
$substr
- Substr
Bytes -
String Expression Operators
operator
$substrBytes
- Substr
Cp -
String Expression Operators
operator
$substrCP
- Subtract
-
Arithmetic Expression Operators
operator
$subtract
- Sum
-
Accumulators ($group)
operator
$sum
- Switch
-
Conditional Expression Operators
operator
$switch
- Tan
-
Trigonometry Expression Operators
operator
$tan
- Text
-
Evaluation
operator
$text
- ToBool
-
Type Expression Operators
operator
$toBool
- ToDate
-
Date Expression Operators
operator
$toDate
- ToDecimal
-
Type Expression Operators
operator
$toDecimal
- ToDouble
-
Type Expression Operators
operator
$toDouble
- ToInt
-
Type Expression Operators
operator
$toInt
- ToLong
-
Type Expression Operators
operator
$toLong
- ToLower
-
String Expression Operators
operator
$toLower
- ToObject
Id -
Type Expression Operators
operator
$toObjectId
- ToString
-
String Expression Operators
operator
$toString
- ToUpper
-
String Expression Operators
operator
$toUpper
- Trim
-
String Expression Operators
operator
$trim
- Trunc
-
Arithmetic Expression Operators
operator
$trunc
- Truncate
-
Arithmetic Expression Operators
operator
$truncate
- Type
-
Element
operator
$type
- Unset
-
Fields
operator
$unset
- Unwind
-
Aggregation pipeline stages
operator
$unwind
- Update
-
Aggregation pipeline stages
operator
$update
- Update
AllDocuments -
Array (update)
operator
$[]
- Update
First Document -
Array (update)
operator
$
- Week
-
Date Expression Operators
operator
$week
- Where
-
Evaluation
operator
$where
- Year
-
Date Expression Operators
operator
$year
- Zip
-
Array Expression Operators
operator
$zip