单条件查询: db.getCollection(‘task‘).find({"id": "dc717654-dc45-4bf9-8e8a-1f1b146d6524"}) 单条件查询(属性为叶子节点) db.getCollection(‘archive_result‘).find({"results.tags.cluster_id":1263})
结果过滤,存在某个字段:
db.getCollection(‘表名‘).find({字段名{$exists:true}})
结果过滤,大于/小于/等于某个值:
db.getCollection(‘cluster‘).find({feature_id:{$lt:627808}})
多条件查询,相当于sql语句中的 select * from table where condition A and condition B;
db.getCollection(‘face_info_01‘).find({feature_id: 1, target_feature_id: 1})多个语句的组合使用:
查询并排序,其中1为升序,-1为降序,相当于select * from table order by * desc/asc;
db.getCollection(‘表名‘).find({字段名{$exists:true}}).sort({时间:1})
查询并求总数,相当于select count(*) from table where A;
db.getCollection(‘file_info‘).find({"file_name":"xidada1.jpg"}).count() 表聚合查询,相当于sql中的join多表查询: db.file_info.aggregate([