is_capped.js 493 B

12345678910111213141516171819
  1. 'use strict';
  2. const OptionsOperation = require('./options_operation');
  3. const handleCallback = require('../utils').handleCallback;
  4. class IsCappedOperation extends OptionsOperation {
  5. constructor(collection, options) {
  6. super(collection, options);
  7. }
  8. execute(callback) {
  9. super.execute((err, document) => {
  10. if (err) return handleCallback(callback, err);
  11. handleCallback(callback, null, !!(document && document.capped));
  12. });
  13. }
  14. }
  15. module.exports = IsCappedOperation;