-1

I have two collections in MongoDb and want to compare those and get the difference into another collections. Also is it possible to have a generic code for this.

  • Sure. You need to use `$lookup` and `$out` operators.[example](https://stackoverflow.com/questions/48478672/using-lookup-in-mongodb) – Valijon Feb 14 '20 at 22:11

1 Answers1

0

yep you can do just u need to use a setter for your 3rd property by using $set and other operators check this out: Query and Projection Operators

  • there are 2 collection say both with same key value pairs. Collection 1(C1) has 10 document in it and Collection 2(C2) has 8 document(similar to 8 document in C1) in it. Now I want the 2 missing data to get copied to C2 without doing a complete refresh from C1. Is this possible. Also we can consider C1 as Production data and C2 as Test collection. – Prakash Zeus Feb 15 '20 at 19:04