I want to check consecutive value of certain items inside a number of arrays in nodejs is there any aggregation technique that can help. suppose i have 5 objects in an array and each object has cetain parameter such as
var arr = [{name: abc,age:10},
{name: gtt,age:12},
{name: sss,age:13},
{name: dddttt,age:14},
{name: abc,age:4} ]
now i want to check that in each object the age is less than 10.what i can do is loop through the array and check every condition and make count or push value. but i want to know is there any technique
首先,您应该$ unwind,它会发生,数组的每个项目都是单独的对象,稍后;
{$match: {"$age": {$lt: 10}}}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.