MongoDB: Determine index of item in array -


is there way determine index of retrieved item in array in mongodb?


i have array of object ids inside document.

{     ids: [id1, id2, id3, ...] } 

i search array id3, , if it's found, want position of object added result. in case, it's can insert more objects after in array.

if can't this, how go creating ordered list of objects can retrieve , modify position of elements in ordered list (since insert operation on list result in modifying position of elements after insert)?


answer:

obtaining positional index not supported in mongodb. open new question redesigning application deal limitation. everyone!

the way see it, have 2 choices:

  • retrieve whole array, mutate wish in language of choice, , update array in db new array.

  • come data structure supports whatever trying do.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -