Second parameter to limit fields in find() not working in Mongodb

前端 未结 3 746
遇见更好的自我
遇见更好的自我 2020-12-20 06:42

Mongodb Database view

I want to omit the _id field in my result

MongoClient.connect(\"mongodb://localhost:27017/\",function(err,client)         


        
3条回答
  •  一个人的身影
    2020-12-20 07:29

    In version 3.4.9 of the mongodb you can simply achieve this by:

    db.getCollection('data').find({}, { _id: 0 })
    

提交回复
热议问题