随笔分类 -  MongoDb

摘要:db.getCollection('ShortProduct').aggregate([{ $lookup: { from: "ShortProductPlans", localField: "_id", foreignField: "productId", as: "plan" } }, { $u 阅读全文
posted @ 2020-03-24 09:31 地球上的我 阅读(1521) 评论(0) 推荐(0)
摘要:db.runCommand({ "update" : "ShortBatchOrder", "updates" : [{ "q" : { "_id" : "xxxxxxxx") }, "u" : { "$set":{"data.$[data].isDelete" : "1"} }, "upsert" 阅读全文
posted @ 2020-03-24 09:29 地球上的我 阅读(3937) 评论(0) 推荐(0)
摘要:db.getCollection('product_protocol_new').aggregate([ {$sort:{"end_date":-1}}, {$group:{ _id:"$company_protocol", end_date:{"$first":"$$ROOT"}, }} ]) 阅读全文
posted @ 2018-08-16 09:28 地球上的我 阅读(3068) 评论(0) 推荐(1)
摘要:db.getCollection('product').find({'coverage':{'$elemMatch':{'plan':{'$elemMatch':{'iscoverage':{'$in':['1']}}}}}}) 其中,coverage是文档的第一级子文档,$elemMatch匹配的 阅读全文
posted @ 2018-05-13 11:38 地球上的我 阅读(8098) 评论(0) 推荐(0)