Home >Database >Mysql Tutorial >Mongo批量更新操作

Mongo批量更新操作

WBOY
WBOYOriginal
2016-06-07 14:53:331672browse

Mongo批量更新操作 使用mongodb的update方法进行多条记录的更新 www.2cto.com Java代码 db.logPreInfo.update({uniqueKey:{$in:[1353314720280-84d0c4e4-620a-4caa-9d85-f96e2b31fed2,1353314942260-fa87ed9c-5c28-49a8-8c2b-93e99dd8cccd,1353314962526-855


Mongo批量更新操作

 

使用mongodb的update方法进行多条记录的更新 

  www.2cto.com  

Java代码  

db.logPreInfo.update({"uniqueKey":{"$in":["1353314720280-84d0c4e4-620a-4caa-9d85-f96e2b31fed2","1353314942260-fa87ed9c-5c28-49a8-8c2b-93e99dd8cccd","1353314962526-85540e9a-c661-4f28-a236-a095fc80f773","1353315669078-dbb33b82-0cff-4a36-8b72-d2e50c9b0e66"]}},{"$set":{"endFlag":"0"}},false,true);  

 

上面的语句能够完成根据uniqueKey数组,对匹配的多条数据做更新操作。 
 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn