I\'m new to mongo and I need your help.
I have collection studijneProgramy. This is sample document:
{
\"_id\" : \"dGFY\",
\
Other than the potential duplicate pointed out by dege, you can use JS as follows if it isn't a lot of data. Using aggregate and $lookup would be faster, but this is cleaner, I believe.
db.studijneProgramy.find().forEach(stu=>{
stu.garranti=stu.garranti.map(gar=>{
gar.garant=db.osoby.find({_id:gar.id})[0];
return gar;
});
db.studijneProgramy.save(stu);
});