使用JAVA在分片环境中更新

时间:2014-12-10 11:50:02

标签: java mongodb sharding

我正在尝试更新提交的内容'在分片环境中的文档。我的分片键是' asset'它包含在查询中。但我收到错误说

  

" com.mongodb.WriteConcernException:{" serverUsed" :   " /10.102.10.190:27017" ,"错误" :"更新{q:{$和:[{资产:   \" /1/01/01.m3u8 \" },{recList:\" REC-1-1418208180000-1418208300000 \"   },}:u:{$ set:{Content:BinData}},multi:false,upsert:false   }}不包含模式{asset:1}的#id或分片键" ,"代码"   :61," n" :0,"分片" :[]," shardRawGLE" :{}," ok" :1.0}"

    BasicDBObject newDocument = new BasicDBObject();
    newDocument.append("$set", new BasicDBObject().append("Content", content));

    BasicDBObject andQuery = new BasicDBObject();
    List<BasicDBObject> obj = new ArrayList<BasicDBObject>();
    obj.add(new BasicDBObject("asset", assetf));
    obj.add(new BasicDBObject("recList", recId));
    andQuery.put("$and", obj);       

    WriteResult result = collection.update(andQuery, newDocument);

请帮帮我。

0 个答案:

没有答案