I am having problem when I do a query to mongodb using pymongo. I do not know how to avoid getting the _id for each record.
I am doing something like this,
result = db.meta.find(filters, [ 'model', 'fields.parent', 'fields.status', 'fields.slug', 'fields.firm', 'fields.properties'])
I do not want to iterate the cursor elements only to delete a field. Thanks,
Joaquin
您可以通过以下方式排除id对象:
db.meta.find({}, {"_id" : 0})
Does make any sense. The object id is core part of each document. Convert the BSON/JSON document to a native datastructure (depending on your implementation language) and remove _id on this level. Apart from that it does not make much sense what you are trying to accomplish.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.