Hi, I’m very new to Meteor, so sorry if this is a dumb questions. I’ve playing around with it for a few days and was hoping someone could give me insight on what would be the easiest way to duplicate a specific document in my collection an arbitrary number of times. Thanks.
I appreciate the reply, but I’m looking to create new documents in my collection based on a preexisting document.
Why not just query the document and iterate for multiple inserts?
Here’s another way: Add the
msavin:mongol package which is a slick little database editor/viewer. After having added the package, press ctrl+M, you can now see your collections, and there’s a button to duplicate the document if I remember right
let doc = Documents.findOne(yourDocID); delete doc._id; _.range(100).forEach(() => Documents.insert(doc));
Thanks for all the help everyone. I have solved my issue using a very similar solution to @veered.