Search Keyword
$ And parallel query
# Are true before they can query the results db.stutent.find ({$ and : [{name: " little whirlpool " }, {Age: 30}]})
Or $ or queries
# There is a condition set up you can check the results db.stu.find ({$ or : [{name: " dazzling " }, {name: " black " }]})
Subqueries $ all
The rear part of all elements of the order list, as long as there will be in the test_list all query results to
> db.stutent.find({"test_list":{$all:[1,"五"]}}) { "_id" : ObjectId("5d2eee1314ff51d814e40365"), "name" : "小漩涡", "age" : 30, "test_list" : [ 1, 2, 3, 4, "五", 1000 ], "hobby" : [ "烫头" ] }
$ In range queries
[ " Dazzling " , " black " , " red " , " black " ] # meet all of the names in the list to find out db.stu.find ({name: {$ in : [ " dazzling " , " black black " , " red " , " black " ]}})
Sort / select / Skip
Sorting: Sort . Db.stu.find () Sort ({Age: . 1}). 1 n Preface - . 1 reverse select: limit db.stu.find () limit (. 2 ) Select two data Skip: Skip DB. . stu.find () skip ( 2 ) skip the first two data selecting among two or before the N skipped db.stu.find () skip (0) .limit (. 2) .sort ({Age: - 1 }) priority: first Sort - skip - select # tab var = 1 Page var NUM = 2 var SK = (Page-1) * NUM db.stu.find () skip (SK) .limit (NUM). .sort ({Age: -1})