I am having a document with array object, like
{
_id:ObjectID(),
infoId:ObjectID(),
infos:[
{
created_at: ISODate("2014-07-16T11:55:24.348Z"),
info:1
},
{
created_at: ISODate("2014-07-16T11:58:45.185Z"),
info:2
},
{
created_at: ISODate("2014-07-16T12:17:12.182Z"),
info:3
},
{
created_at: ISODate("2014-07-16T12:19:59.171Z"),
info:4
},
{
created_at: ISODate("2014-07-16T12:27:30.925Z"),
info:5
},
]
}
**From this document I want get the infos whose create_at is greater than say ISODate("2014-07-16T12:10:12.182Z") till end. Along with it I want to know the index of these retrieved records. **
In my example I want the result as :
[{
created_at: ISODate("2014-07-16T12:17:12.182Z"),
info:3
},
{
created_at: ISODate("2014-07-16T12:19:59.171Z"),
info:4
},
{
created_at: ISODate("2014-07-16T12:27:30.925Z"),
info:5
}]
with some way to get the index too.
One way to get index is, if I stored index also along with created_at and info I will get. But I may delete specific records too, then for that case I need to update all the records after that again. SO I am not keeping index explicitly.