Take the maximum value of the Time field:
Db.getcollection (' Calllog '). Find (). Sort ({"Time": -1}). Limit (1)
Minimum value only need to change –1 to 1
Db.getcollection (' Calllog '). Find (). Sort ({"Time": 1}). Limit (1)
Appcode field is not equal to "100001" record
Db.getcollection (' Calllog '). Find ({"Appcode": {$ne: "100001"}})
Support <, <=, >= query, with symbolic substitution for $lt, $lte, $GT, $gte
Db.colls.find ({"field": {$gt: Value}});
Db.colls.find ({"field": {$lt: Value}});
Db.colls.find ({"field": {$gte: Value}});
Db.colls.find ({"field": {$lte: Value}});
You can also make a range query for a field
Db.colls.find ({"field": {$gt: value1, $lt: value2}});
Not equal to query character $ne
Db.colls.find ({x: {$ne: 3}});
In query with character $in
Db.colls.find ({"field": {$in: Array}});
Db.colls.find ({j:{$in: [2,4,6]}});
Not in query with character $nin
Db.colls.find ({j:{$nin: [2,4,6]}});
Character $mod for modulo query
Db.colls.find ({A: {$mod: [ten, 1]}})//where a% 10 = = 1
$all Query
Db.colls.find ({A: {$all: [2, 3]}});//Specifies that a satisfies any value in the array
$size Query
Db.colls.find ({A: {$size: 1});//The number of objects queried, this query queries the number of child objects of a 1 record
$exists Query
Db.colls.find ({A: {$exists: true}}); There is data for the A object
Db.colls.find ({A: {$exists: false}}); There is no data for the A object
$type Query the type value of the $type value to bsonhttp://bsonspec.org/data
Db.colls.find ({A: {$type: 2}}); Match A to string type data
Db.colls.find ({A: {$type: 16}}); Match A to int type data
Examples of common query commands for MongoDB