Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add isCapped() to collection.js

  • Loading branch information...
commit fa3d000ca661b5881751be81d12bb4239f237c93 1 parent f1a6bdc
@yorkie yorkie authored
Showing with 16 additions and 1 deletion.
  1. BIN  .DS_Store
  2. +15 −0 lib/collection.js
  3. +1 −1  lib/cursor.js
View
BIN  .DS_Store
Binary file not shown
View
15 lib/collection.js
@@ -294,6 +294,21 @@ MongolianCollection.prototype.distinct = function(key, query, callback) {
}))
}
+MongolianCollection.prototype.isCapped = function(callback) {
+ collName = this.db.name + "." + this.name;
+ this.db.collection("system.namespaces").findOne({name:collName}, function(err, result) {
+ if (typeof callback !== 'function') return;
+ if (err) {
+ callback(err)
+ }
+ if (!result || !result.options) {
+ callback("Could not find this Collection.")
+ } else {
+ callback(null, result.options.capped, result.options.size)
+ }
+ })
+}
+
MongolianCollection.prototype.toString = function() {
return this.db + "." + this.name
}
View
2  lib/cursor.js
@@ -239,7 +239,7 @@ function _count(self, usingSkipAndLimit, callback) {
query.query = self.criteria
}
if (usingSkipAndLimit) {
- query.skip = self._skip
+ query.skip = self._skip || 0
query.limit = self._limit
}
self.db.runCommand(query, safetyNet(callback, function(result) {
Please sign in to comment.
Something went wrong with that request. Please try again.