【MonogoDB】The high update operation of MongoDB
来源:互联网 发布:淘宝客返利是什么意思 编辑:程序博客网 时间:2024/05/01 13:48
In the last four blog, we talked about the high query operation of mongodb. Now in this blog let's know about the high update operation about monodb.
1. Save
as for save(), whose function is to update the existing record and to create the new record.
grammar: db.mycollection.save(x);
2. General Operation
2.1 $inc
grammar: { $inc : { field : value } }
function: add the value to the certain field.
example:
2.2 $Set and $unset
{ $set : { field : value } } / { $unset : { field : 1 } }
function: set the field value, if the field does not exist, then add the new field, and value will support all the type.
2.3 $push, $pushAll,$addToSet
{ $push : { field : value } }
function: if the field is a existing arry, this function will add the value to the end. if filed doesnot exist, it will add the new field, and then set the field value. if field do exists but not array, it will throw error.
$pushAll: { $pushAll : {field : value_array } }
this function is the same as $push, but only the value_array is array.
$addToSet: { $addToSet : { field : value } }
2.4 $pop and $pull $pullAll
2.5 $rename
{ $rename : { old_friend_name: new_field_name}}
0 0
- 【MonogoDB】The high update operation of MongoDB
- 【MongoDB】The high Query operation of MongoDB(一)
- 【MongoDB】The high query operation of MongoDB(二)
- 【MongoDB】The high query operation of MongoDB(三)
- 【MongoDB】The basic operation of Mongodb, Insert\Query\Delete\Update
- 【MongoDB】The basic operation of Index in MongoDB
- 【MongoDB】The basic operation of Index in MongoDB
- the operation of recursion
- monogoDB
- mongoDB基础知识----搭建简单的monogoDB服务器
- The tail of MongoDB
- 遇到错误----Mongodb----导出数据报错 Sort operation used more than the maximum 33554432 bytes of RAM
- The operation order of instance creation
- The art in general operation of linux
- The art in general operation of Windows
- Restore the operation of linux rm -rf
- the basic operation of sequence in python
- Some frequent operation of the git
- Quicksort
- 数据结构java版三 Java内置数据结构
- python多线程在socket编程中的应用(代码范例)
- 将博客搬至CSDN
- 12个乒乓球称3次,分出轻重
- 【MonogoDB】The high update operation of MongoDB
- 线性回归(Linear Regression,LR)
- malloc过程中做了那些?
- 分析JDK动态代理较好的文章
- FOJ1138 Easy Task
- Android 图片失真的原因
- GCD(Grand Central Dispatch)和Block 使用-浅析
- rmmod: chdir(/lib/modules): No such file or directory 解决方法 (转)
- 获取3G或wifi流量信息