[][src]Module mongodm::operator

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

AddToSet

Array (update) operator $addToSet

All

Array (query) operator $all

And

Logical operator $and

Bit

Bitwise (update) operator $bit

BitsAllClear

Bitwise (query) operator $bitsAllClear

BitsAllSet

Bitwise (query) operator $bitsAllSet

BitsAnyClear

Bitwise (query) operator $bitsAnyClear

BitsAnySet

Bitwise (query) operator $bitsAnySet

Comment

Comments operator $comment

CurrentDate

Fields operator $currentDate

Each

Modifiers operator $each

ElemMatch

Array (query) operator $elemMatch

Equal

Comparison operator $eq

Exists

Element operator $exists

Expr

Evaluation operator $expr

GeoIntersects

Geospatial operator $geoIntersects

GeoWithin

Geospatial operator $geoWithin

GreaterThan

Comparison operator $gt

GreaterThanEqual

Comparison operator $gte

In

Comparison operator $in

Inc

Fields operator $inc

JsonSchema

Evaluation operator $jsonSchema

LesserThan

Comparison operator $lt

LesserThanEqual

Comparison operator $lte

Max

Fields operator $max

Meta

Projection operator $meta

Min

Fields operator $min

Mod

Evaluation operator $mod

Mul

Fields operator $mul

Near

Geospatial operator $near

NearSphere

Geospatial operator $nearSphere

NoneIn

Comparison operator $nin

Nor

Logical operator $nor

Not

Logical operator $not

NotEqual

Comparison operator $ne

Or

Logical operator $or

Pop

Array (update) operator $pop

Position

Modifiers operator $position

ProjectFirst

Projection operator $

Pull

Array (update) operator $pull

PullAll

Array (update) operator $pullAll

Push

Array (update) operator $push

Regex

Evaluation operator $regex

Rename

Fields operator $rename

Set

Fields operator $set

SetOnInsert

Fields operator $setOnInsert

Size

Array (query) operator $size

Slice

Projection operator $slice

Sort

Modifiers operator $sort

Text

Evaluation operator $text

Type

Element operator $type

Unset

Fields operator $unset

UpdateAllDocuments

Array (update) operator $[]

UpdateFirstDocument

Array (update) operator $

Where

Evaluation operator $where