views:

62

answers:

1

Hi folks,

my "table" look like this:

{'name':'Rupert', 'type':'Unicorn', 'actions':[
    {'time':0, 'position':[0,0], 'action':'run'},
    {'time':50, 'position':[50,0], 'action':'stoprun'},
    {'time':50, 'position':[50,0], 'action':'jump'},
    {'time':55, 'position':[50,0], 'action':'laugh'},
    ...
]}

any way I can index the items within the actions list? Or do I have to split them up in tables?

It would be A LOT more convenient for me to keep the actions within the table row.


Any ideas? =)

+1  A: 

Thanks to skot in #mongodb!!

One solution is:

[...].ensureIndex({"actions.time":1})

for creating an index on the time field within the actions list.

RadiantHex