-1

My hierarchy of List (Schema) is as follows:

List -> Items -> (attachments, comments, labels)

I want to create another duplicate list (collection) of the existing list. This means, all hierarchical referenced elements should be created (copied). Here (attachments, comments, labels) are referenced by Item and Item is referenced by List. How can I do that?

honk
  • 9,137
  • 11
  • 75
  • 83
Dhruv Koshiyar
  • 167
  • 1
  • 10

1 Answers1

0

That's called a "deep copy". I'm not sure what mongoose has to do with it. See this question for JavaScript in general: What is the most efficient way to deep clone an object in JavaScript?

Roland Weber
  • 1,865
  • 2
  • 17
  • 27