db.mycoll.find()
db.mycoll.find().pretty()
db.mycoll.find({"title":"fcy"})————-等于
db.mycoll.find({"age":{$lt:30}}) ——小于
db.mycoll.find({"age":{$lte:30}}) —-小于等于
db.mycoll.find({"age":{$gt:30}}) —–大于
db.mycoll.find({"age":{$gte:30}}) —大于等于
db.mycoll.find({"age":{$ne:30}}) —-不等于
db.mycoll.find({"money":{$lt:80,$gt:50}})—-小于80大于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为升序,-1为降序
举例:
db.getCollection(‘Z3_TOPIC_XREF_EQUITY’).find({"innerCode":"000001.SZ"})
db.getCollection(‘Z3_BACKTEST_STRATEGY_FILTER’).find({},{‘evaluation_indexs.near_week_return’:1,’strategy_name’:1}).sort({"evaluation_indexs.near_week_return":-1}).limit(7)
原创文章,作者:kepupublish,如若转载,请注明出处:https://blog.ytso.com/193389.html