Browse Source

Implement isCapped

saintedlama/travis-non-legacy
saintedlama 9 years ago
parent
commit
180abe8b36
  1. 13
      lib/collection.js

13
lib/collection.js

@ -210,16 +210,11 @@ Collection.prototype.reIndex = function (cb) {
}
Collection.prototype.isCapped = function (cb) {
var cursor = new Cursor({
query: {name: this._fullColName()},
projection: {},
onserver: this._getConnection,
fullCollectionName: this._dbname + '.system.namespaces'
})
var self = this
this._getConnection(function (err, connection) {
if (err) { return cb(err) }
cursor.toArray(function (err, cols) {
if (err) return cb(err)
cb(null, (cols[0].options && cols[0].options.capped) || false)
connection.collection(self._fullColName()).isCapped(cb)
})
}

Loading…
Cancel
Save