Db.tb1.find ()//query all, use it to view the next page.
Db.tb1.find ({"Age": 1})//Check the records of Ages ==1
Db.tb1.find ({},{"age": 1})//Check records for ages ==1
Db.tb1.find ({"name": {$all: ["A", "B"]}})//query name contains a/b record
Db.tb1.find ({"name": {$exists: true}})//query for records that exist in the Name field.
Db.tb1.find ({"Age": {$nin: [12,14]}})//query for records with age that do not contain 12,14 values.
Db.tb1.find ({name)//query name a record with a letter
.......
Summarized as follows:
The query format is as follows: Db.collection.find ({"field": {Operator:val}})
field is Colleciton, operator is the operator, and Val is the comparison value.
Operator are as follows:
$GT, $gte, $lt, $lte: Val? V1.
$all: All there, Val? {V1,v2,v3 ...}
$exists: Exist, Val? True/false;
$ne: Not Equal, Val? V1
$mod: Take the mold. Val? [V1 modulus, v2 remainder]
$in: Contains a value, Val? [V1,v2,v3 ...]
$nin: Does not contain a value, Val? [V1,v2,v3 ...]
$size: Specify an array of lengths, Val? V1
$regex: Regular queries, Val? V1: Wildcard query:/s/, but s/,/is such a syntax error.
JavaScript query: Write function, then query.
>find (condition). Count ()/limit (v)/skip (v)/sort ({"Field": 1/-1},{"Field2": 1/-1} ...)
Paged query, through Limit,skip,sort combination for paging query.
As per page x, page n
> Find (Conditions). SKIP * X). Limit (X). SORT.
Distinct: Queries the different values of the specified key. Db.runcommand ({"distinct": "Collection Name", "Key": "Field Name"})
Group: more complex.
Conditional filtering Summary in MongoDB command mode