MongoDB查询对象没有字段
我正在尝试查询一个完整的mongoDB字段,但没有实习字段,例如此文档示例:
{
_id: ObjectId('x8234728x8z8381'),
Example: {
field1: 'first',
field2: 'second',
field3: {
field 3.1: 'third'
}
}
}
我想返回所有“示例”字段,但没有“ $ field2”。在MongoDB中有可能吗?
I'm trying to query a full mongodb field but without an intern field, like this document example:
{
_id: ObjectId('x8234728x8z8381'),
Example: {
field1: 'first',
field2: 'second',
field3: {
field 3.1: 'third'
}
}
}
I would like to return all "Example" field, but without "$field2". Is it possible in mongodb?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只是在投影中忽略它。
You just ignore it in projection.
您可以使用
查找
,然后不是要消除的字段“项目”。在
You can use
find
and then just not "project" the fields you want to eliminate.Try it on mongoplayground.net.