I ve got a collection users that look like this :
{
_id: myid,
name : 'blabla',
ia : {
[0]-> 'an id',
[1]-> 'a second id'
}
}
And i want to have only my first id of ia, so i tried something like that :
User.find({ _id: id, ia :{ key : indexia} }, ['ia']).populate('ia').run(rendu);
where id= myid, and indexia=0.
If i don t put that part : ” ia :{ key : indexia}” i get all my ia… but i want only one.
Hope i was clear.
Thanks
Thanks for your help
It worker like that:
The only(‘ia’) don t work, but not a big deal.