mongodb - Select documents where doc.arr[i]>n -


i have collection elements this:

{ name: "smith", fields: [10, 20, 30] } 

is there way select documents second value of fields array ( fields[1]) > 15 ?

one solution is:

 //create multikey index on field db.test.createindex({"fields.1" : 1})  db.test.find({"fields.1" : {$gt : 15}}) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

reflection - How to access the object-members of an object declaration in kotlin -

php - Doctrine Query Builder Error on Join: [Syntax Error] line 0, col 87: Error: Expected Literal, got 'JOIN' -