mongodb 查询

某个字段是否存在:

db.collection.find({ 字段名:{ $exists: true } }).limit(1)       只查询1条数据

查询表中包含字段file的数据,只显示1条:

db.collection.find({ file: { $exists: true } }).limit(1)

删除

删除所有包含该字段名的数据

db.collection.remove({ 字段名:{ $exists: true } })

统计

统计数据中包含该字段名的总数

db.collection.count({ 字段名:{ $exists: true } })

你可能感兴趣的:(mongodb 查询)