如何使用mongoDB凝聚将文档值转换为数组?
我需要实现这一简单的事情。我有这两个文档
1: {a="010", b="020", c="030"}
2: {a="030", b="040", c="050"}
需要使用MongoDB聚合来获取以下文档:
{ result = [{a="010", b="020", c="030"}, {a="030", b="040", c="050"}] }
非常感谢
I need to achieve this simple thing. I have these 2 documents
1: {a="010", b="020", c="030"}
2: {a="030", b="040", c="050"}
I need to obtain the following document using mongodb aggregations:
{ result = [{a="010", b="020", c="030"}, {a="030", b="040", c="050"}] }
Thank you very much
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
])
将结果分组为一个数组。
])
Group all the docs under result as an array.