I am using javascript to run a 2-pronged search. Variable test has a count of 5. The js part runs however it does not run the mongodb query. As you can see below, the mongo query gives the count 15 which only address' object number 4 in the variable test;test[4].count =15. There is no query from 0 to 3.
var test=db.categories.find({"path":/English\/TEST/OG/},{"path":1})
test.length()==5
for(i=0;i<test.length();i++)
{
print(i);
db.assets.find({"title.categories":test[i].path}).count()
}
0
1
2
3
4
15
Seems to be skipping the query until the end.