Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

MongoDB query statement

Shulou Source: shulou.com Published: 2022-06-03 05:20:53 11月24日 Update

Db.mycoll.find ()

Db.mycoll.find () .pretty ()

Db.mycoll.find ({"title": "fcy"})-equals

Db.mycoll.find ({"age": {$lt:30})-less than

Db.mycoll.find ({"age": {$lte:30}})-less than or equal to

Db.mycoll.find ({"age": {$gt:30}})-greater than

Db.mycoll.find ({"age": {$gte:30}})-greater than or equal to

Db.mycoll.find ({"age": {$ne:30}})-not equal to

Db.mycoll.find ({"money": {$lt:80,$gt:50}})-data less than 80 and greater than 50

Db.mycoll.find ({"name": 35, "title": "teacher"})-and

Db.mycoll.find ({$or: [{"name": "Jerry"}, {"age": 23}]})-or

Db.mycoll.find () .sort ({"age": 1}) .limit (10)-1 is ascending order,-1 is descending order

For example:

Db.getCollection ('Z3 Topics XREFICS EQUITY'). Find ({"innerCode": "000001.SZ"})

Db.getCollection ('Z3BACKTESTSTESTRATEGY filtered). Find ({}, {' evaluation_indexs.near_week_return':1,'strategy_name':1}). Sort ({"evaluation_indexs.near_week_return":-1}) .limit (7)

Tags: Ascending order data statement query Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS Shulou Technology Huawei Xiaomi