Mete
(Mete)
1
I have a very similar problem as in the topic below.
Copy Specific document in same collection
So I will simply clone the docs in the same collection, will remove _id field and update some other fields. I don’t want to bring data to the server and insert afterwards.
How to prevent Halloween problem described here https://www.mongodb.com/docs/manual/reference/operator/aggregation/merge/#output-to-the-same-collection-that-is-being-aggregated by following @steevej approach.
Is it a good approach to set unique indexes and expect potential fails after re-read and re-insert cases using whenMatched: “keepExisting”
steevej
(Steeve Juneau)
2
Your use-case is not clear.
Share the code you have in mind and we can see if there is any pitfalls.