Copy documents of one collection to another using c# mongodb driver

658 views
Skip to first unread message

Kriti Agarwal

unread,
Jul 12, 2016, 11:50:21 AM7/12/16
to mongodb-csharp

 Hi,


Below command works on shell  to copy documents from People collection to "CopyPeople"

db.People.aggregate([{ $out: "CopyPeople" } ])


How would the same code be translated into C# ??


Or is there any other method by which it can be done.


I am aware of the fact that i can read documents one by one from a collection and make a batchinsert to another collection.


I am looking for a single line of code which can perform the same.


Regards,

Kriti

Reply all
Reply to author
Forward
0 new messages