Mongo查询以迁移文档字段

时间:2018-11-12 09:46:43

标签: mongodb mongodb-query

我有2个收藏集:

  1. iam_ms_user
    {  
       "_id" : "5b97743bbff66e0be66283cc",
       "_class" : "com.mmi.anchorapi.model.User",
       "username" : "mmi_superadmin",
      "password" : "$2y$10$rW6u8lX1AmpXxa8DZeQiyOiBP60GTj7Wj0th1kLq4dT5wtLRtprOG",
       "email" : "kaveesh@mapmyindia.co.in",
       "status" : 0,
       "phoneNo" : "9711185305",
       "attemptLeft" : 0,
       "lastLogin" : "0",
       "accId" : "5b97743bbff66e0be66283cb"
    }
  1. iam_ms_userDetails
    {  
       "_id" : "5b97743bbff66e0be66283cd",
       "_class" : "com.mmi.anchorapi.model.UserDetails",
       "userId" : "5b97743bbff66e0be66283cc",
       "dob" : "0",
       "anniversary" : "0",
       "createdOn" : "1536652347312",
       "createdBy" : "mmi_superadmin",
       "updatedOn" :"0",
       "name":"mmi_superadmin"
    }

iam_ms_user中的ID = iam_ms_user中的userId详细信息

问题 基于正确的ID匹配,对于数据库中存在的所有文档,iam_ms_userDetails中的名称应移至iam_ms_user。

请建议我一个查询。

0 个答案:

没有答案