我在mongodb中有两个集合:ColA
,ColB
。
在colA
:
"_id" : "89479574905"
"NETWORK" : "AAA",
"BUSINESS_ID" : "148013"
在colB
:
"_id" : "78787878"
"NETWORK" : "BBB",
"BUSINESS_ID" : "148456",
"BUSINESS_NAME" : "Hello",
"BUSINESS_URL" : "www.some.net",
"LOCATION" : "Delhi"
我想更新colA
,以便结果应为:
"_id" : "89479574905"
"NETWORK" : "AAA",
"BUSINESS_ID" : "148013",
"BUSINESS_NAME" : "Hello",
"BUSINESS_URL" : "www.some.net",
"LOCATION" : "Delhi"
如果colA
中出现相同的字段,则不要仅更新插入其他字段。
你会怎么做?