【发布时间】:2020-07-06 11:15:04
【问题描述】:
下面是我的收藏,你能告诉我如何编写代码从下面的收藏中删除重复记录,收藏中有重复记录,请解释我如何从收藏中删除重复记录。
/* 1 */
{
"_id" : ObjectId("5e84200bdf949c00404ed5ff"),
"area" : "573",
"bc" : "GER",
"bd" : "52001450",
"bg" : "52001450",
"borg" : "cde5642",
"bsg" : "51585929",
"bsgname" : "INFO TECHNOLOGY",
"consulting" : null,
"mobilePhoneNumber" : null,
"cfax" : null,
"l" : "BERL",
"cpgr" : null,
"o" : "S",
"friendlyCountryName" : "Germ",
"ctel" : "+49",
"mail" : "tl2625@ge.at.com",
"exch" : "204",
"ext" : "5408",
"facsimileTelephoneNumber" : null,
"givenName" : "POMAS",
"employeeNumber" : "0249527",
"jt" : "MC",
"jtname" : "FLEX FORCE ENGINEER IV",
"sn" : "LEMP",
}
/* 2*/
{
"_id" : ObjectId("5e84200bdf949c00404ed601"),
"area" : "573",
"bc" : "GER",
"bd" : "52001450",
"bg" : "52001450",
"borg" : "cde5642",
"bsg" : "51585929",
"bsgname" : "INFO TECHNOLOGY",
"consulting" : null,
"mobilePhoneNumber" : null,
"cfax" : null,
"l" : "BERL",
"cpgr" : null,
"o" : "S",
"friendlyCountryName" : "Germ",
"ctel" : "+49",
"mail" : "tl2625@ge.at.com",
"exch" : "204",
"ext" : "5408",
"facsimileTelephoneNumber" : null,
"givenName" : "POMAS",
"employeeNumber" : "0249527",
"jt" : "MC",
"jtname" : "FLEX FORCE ENGINEER IV",
"sn" : "LEMP",
【问题讨论】:
-
你怎么能有2个具有相同objectId的文档?
-
是更新专家,谢谢。
-
如果文档重复,您决定哪些键?
-
你可以使用这个答案stackoverflow.com/a/33364353/8307456
-
关于“employeeNumber”:“0249527”,我该如何写删除重复的员工
标签: mongodb mongodb-query