【问题标题】:MongoDB query to retrieve all the content from array?MongoDB查询从数组中检索所有内容?
【发布时间】:2020-07-10 01:21:17
【问题描述】:
我有更多数组,但我只想检索“PIZZAS”的内容
谁能告诉我哪个是正确的查询?
【问题讨论】:
标签:
javascript
arrays
json
mongodb
helper
【解决方案1】:
您可以通过投影来完成此操作。在 mongo shell 中是这样的:
db.collection.find({}, { PIZZAS: 1, _id: 0})