Start a new topic

How to clone a tree of objects?

Example, I clone objects:

```modules.collectionAccess.collection('Shops').find({"_acl.creator": "526182566bbfcbf587000518"}, function(err, shops) {

if(err == null) {

shops.forEach(function (shop) {

shop._id = null;

});

modules.collectionAccess.collection('Shops').insert(shops);

}

});```

But shop.parent_id property needs to be changed too at each object. Whether it is possible to make somehow it without primary saving of objects in a collection, then their repeated reading of a collection, then parent_id changes, then repeated saving?
1 Comment

Hi Andrey, I'm trying to figure out exactly what you're trying to do. Can you help me understand the use case a bit better?
Login or Signup to post a comment