Skip to content

Instantly share code, notes, and snippets.

@aNd1coder
Last active September 18, 2016 02:40
Show Gist options
  • Save aNd1coder/761a5b2b1a3695c65096302d78b2ea62 to your computer and use it in GitHub Desktop.
Save aNd1coder/761a5b2b1a3695c65096302d78b2ea62 to your computer and use it in GitHub Desktop.
MongoDB 常用工具
/* 新增字段 */
db.getCollection('collection_name').update({},{$set:{'field_name':'xxx'}},false,true)
/* 删除字段 */
db.getCollection('collection_name').update({},{$unset:{'field_name':''}},{multi:true})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment