阅读(1227) (0)

Nedb db.count()

2017-07-11 19:18:20 更新

db.count(query, callback)

作用:

计数。与find用法相同。

示例:


// Count all planets in the solar system
db.count({ system: 'solar' }, function (err, count) {
  // count equals to 3
});
 
// Count all documents in the datastore
db.count({}, function (err, count) {
  // count equals to 4
});