mongo 修改列名称

db.tasks.update(
  {
    "tid":"1",
    "replys":{"$exists":true}
  },
  {"$rename":{"replys":'replies'}},
  {multi:true}
);

{"tid":"1",  "replys":{"$exists":true}} 为条件;

{"$rename":{"replys":'replies'}} 将符合条件的replys名称修改为replies

{multi:true} 作用于多条行

 

You haven't logged in yetLogin OrRegisterAdd comments after
Popular Articles
Popular Tags
Java(22)
Recently published