I have two mongoDB collections named users and users_custom. For example: users collection looks like:
{
"_id" : ObjectId("53ac64d445fa47e97a5f3b50"),
"user_id" : "1",
"Name" : "Mr. A",
"phone" : "12345"
}
{
"_id" : ObjectId("53ac64e145fa47e97a5f3b53"),
"user_id" : "2",
"Name" : "Mr. B",
"phone" : "23456"
}
users_custom collection looks like:
{
"_id" : ObjectId("53ac64d445fa47e97a5f3b32"),
"user_id" : "1",
"Name" : "Mr. A Modified",
"email" : "someone@gmail.com"
}
{
"_id" : ObjectId("53ac64e145fa47e97a5f3b232"),
"user_id" : "2",
"Name" : "Mr. B",
"address" : "some address"
}
I want to merge users_custom collection over users collection into users_final collection. That way it will looks like:
{
"_id" : ObjectId("53ac64d445fa47e97a5f3b32"),
"user_id" : "1",
"Name" : "Mr. A Modified",
"phone" : "12345"
"email" : "someone@gmail.com"
}
{
"_id" : ObjectId("53ac64e145fa47e97a5f3b232"),
"user_id" : "2",
"Name" : "Mr. B",
"phone" : "23456"
"address" : "some address"
}
Any idea or example code will be greatly appreciated. Thanks in advance.