-
Notifications
You must be signed in to change notification settings - Fork 0
MongoDb
Thomas Czogalik edited this page Mar 2, 2021
·
7 revisions
- find({field:value}) // finde Objekt mit field === value)
- find({field: {$exists: true/false} }) // finde Objekt, dass Feld (nicht) hat
- pattern:
- find({value: /pattern/})
- { $and: [ { expression1 }, { expression2 } , ... , { expressionN } ] }
- update({field:value}, {$set:{somefield:someValue}})
- update({field:value}, {$set:{somefield:someValue}}, false, true) // multiupdate
db.collection.update(
<query>,
<update>,
{
upsert: <boolean>,
multi: <boolean>,
writeConcern: <document>,
collation: <document>,
arrayFilters: [ <filterdocument1>, ... ],
hint: <document|string> // Available starting in MongoDB 4.2
}
)
({$where:"this.fieldA == this.fieldB"})
({$where:"this.fieldA != this.fieldB"})
({$where:"this.fieldA >= this.fieldB"})
{
someDateField: {
$gte:IsoDate(y-m-dTH:M:S),
$lt:IsoDate(y-m-dTH:M:S)
}
}
- Equality tests, in any order
- Sort fields, in the order requested by the query
- Range filters, in increasing order of cardinality