简体   繁体   English

MongoDB 查询以检索数组中的所有内容?

[英]MongoDB query to retrieve all the content from array?

I have more arrays but I only want to retrieve content of "PIZZAS"我有更多 arrays 但我只想检索“PIZZAS”的内容

anybody could tell me which is the correct query?任何人都可以告诉我哪个是正确的查询?

这是我存储在 mongoDB 中的 BSON

You can accomplish this by doing a projection.您可以通过投影来完成此操作。 In the mongo shell it looks like this:在 mongo shell 中,它看起来像这样:

db.collection.find({}, { PIZZAS: 1, _id: 0})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM