84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
There is an existing array as follows,
const idArr = ['5950b7bfe78afb0868dc6599','5950b532b3c06f0838ed47e2','5950afcc85881f07bf454232']; //数组每一项都作为查询的_id,遍历查询,该如何操作呢? idArr.forEach((item,index)=>{ db.details.find({_id:item}); //这样吗?还是。。。 });
欢迎选择我的课程,让我们一起见证您的进步~~
The answer was found in the official documentation of mongodb
const idArr = ['5950b7bfe78afb0868dc6599','5950b532b3c06f0838ed47e2','5950afcc85881f07bf454232']; db.details.find({_id:{$in:idArr}); //这样就可以了,一次全部查出来
The answer was found in the official documentation of mongodb