v1.10

Document

How to Start SequoiaDB

Basic Operation

Data Model

Database Management

Aggregation

Index

Replication

Cluster

Connector

Reference

Development

Release Note

FAQ

  • Content
  • Comments
  • History

Operator

Update Operator Description Information Samples
$inc increase add the given value to the value of specified field. db.foo.bar.update({$inc:{age:25}})
$set set the specified field set the given value to the specified field. db.foo.bar.update({$set:{age:10}})
$unset delete the specified field delete the specified field of object. db.foo.bar.update({$unset:{age:""}})
$addtoset add to set if the given element doesn't exist in the array, then added, otherwise skipped. the object field
must be array type.
db.foo.bar.update({$addtoset:{array:[3,4,5]}})
$pop pull the last of N values in the array pull the last of N values in the array, the object field must be array type(if N less than 0 means
that delete the first of -N values from the beginning of array).
db.foo.bar.update({$pop:{array:2}})
$pull pull values pull the specified value from the object array, the object element must be array. db.foo.bar.update({$pull:{array:2}})
$pull_all pull array pull each of the elements in the specified array from the object array. the object element must
be array type.
db.foo.bar.update({$pull_all:{array:[2,3,4}})
$push push values push the value to the object array, the object element must be array type. db.foo.bar.update({$push:{array:2}})
$push_all push array push each of values in the specified array to the object array, the object element must be array
type.
db.foo.bar.update({$push_all:{array:[2,3,4}})

operator description samples
$gt greater than db.foo.bar.find({age:{$gt:20}})
$gte great than or equal db.foo.bar.find({age:{$gte:20}})
$lt less than foo.bar.find({age:{$lt:20}})
$lte less than or equal db.foo.bar.find({age:{$lte:20}})
$ne not equal db.foo.bar.find({age:{$ne:20}})
$in exist in collection db.foo.bar.find({age:{$in:[20,21]}})
$nin not exist in collection db.foo.bar.find({age:{$nin:[20,21]})
$all all db.foo.bar.find({age:{$all:[20,21]}})
$and and db.foo.bar.find({$and:[{age:20},{name:"Tom"}]})
$not not db.foo.bar.find({$not:{age:20},{name:"Tom"}})
$or or db.foo.bar.find({$or:{age:20},{name:"Tom"}})
$type date type db.foo.bar.find({age:{$type:16}})
$exists exist db.foo.bar.find({age:{$exists:1}})
$elemMatch element match db.foo.bar.find({age:{$elemMatch:20}})
$+Identifier Matching array elements db.foo.bar.find({"array.$2":10})
$size size db.foo.bar.find({array:{$size:3}})
$regex regex db.foo.bar.find({str:{$regex:'dh.*fj',$options:'i'}})

Parameter name Description Example
$project Select the field name to be output, "1" indicates that the output "0" means no output, you can also implement fields. {$project:{field1:1,field:0,aliase:"$field3"}}
$match Select the matching criteria to achieve from a collection of records, quite where the SQL statement. {$match:{field:{$lte:value}}}
$limit Limit the number of records returned. {$limit:10}
$skip Start point control of the result set, the result set that skips the number of records specified. {$skip:5}
$group Achieve grouping of records, similar to SQL's group by statement, "_id" designated group field. {$group:{_id:"$field"}}
$sort Achieve the sort of result set "1" represents Ascending, "-1" for descending. {$sort:{field1:1,field2:-1,...}}

$group Aggregation operator supports the following aggregate functions:
Function name Description
$addtoset Adds the specified field values in the array, the same field value will be added once.
$first Take packet field values in the first record.
$last Take packet field value in the record.
$max Take the maximum value of the packet field.
$min Take the smallest packet field values.
$avg Take the average packet field values.
$push Add all the fields to the array, even if the same array of field values that already exist, and continue to add.
$sum Take the sum of packet field values.
please login to comment.
Latest Comment
  • 2015-02-15

About Us

SequoiaDB is a financial-level distributed database vendor and is the first Chinese database listed in Gartner’s Magic Quadrant OPDBMS report. SequoiaDB has recently released version 3.0.
SequoiaDB is now penetrating the vertical sector Financial Industry quickly and had more than 50 banking clients and hundreds of enterprise customers in industries including government, telecommunication, Internet and IoT.

Beijing:
Tower R, No.8 North Star East Road, Chaoyang District, Beijing,China
Guangzhou:
Tower A, No.22 Qinglan Street, Panyu District, Guangzhou,China
Shenzhen:
Tsing Hua Tech Park, Nanshan District, Shenzhen,China
Tel:400-8038-339
E-mail:contact@sequoiadb.com