51Testing软件测试论坛
标题:
mongdb怎么实现同时find和count
[打印本页]
作者:
测试积点老人
时间:
2020-2-10 13:18
标题:
mongdb怎么实现同时find和count
mongdb怎么实现同时find和count
假设有文档:
[
{ name: 'a', content: 'xxx', list: [ 'A', 'A', 'C' ] },
{ name: 'b', content: 'yyy' ,list: [ 'A', 'B' ] },
{ name: 'c', content: 'zzz', list: [ 'B' ] }
]
复制代码
期望统计 list 中元素个数,并保持其他信息字段不变:
[
{ name: 'a', content: 'xxx', list: 3 },
{ name: 'b', content: 'yyy' ,list: 2 },
{ name: 'c', content: 'zzz', list: 1 }
]
复制代码
请问在 mongodb 要怎么写查询语句?
作者:
jingzizx
时间:
2020-2-11 10:49
按照语法测试编写
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2