How to use the bson.Long.fromInt function in bson

To help you get started, we’ve selected a few bson examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github onehilltech / blueprint / packages / blueprint-gatekeeper / node_modules / mongoose / node_modules / mongodb / lib / mongodb / command_cursor.js View on Github external
this.close = function(callback) {
    // Close the cursor if not needed
    if(cursorId instanceof Long && cursorId.greaterThan(Long.fromInt(0))) {
      try {
        var command = new KillCursorCommand(this.db, [cursorId]);
        // Added an empty callback to ensure we don't throw any null exceptions
        db._executeQueryCommand(command, {connection:connection});
      } catch(err) {}
    }

    // Null out the connection
    connection = null;
    // Reset cursor id
    cursorId = Long.fromInt(0);
    // Set to closed status
    state = 'closed';
    // Clear out all the items
    items = null;

    if(callback) {
      callback(null, null);
    }    
  }
github nswbmw / N-blog / node_modules / mongodb / lib / mongodb / cursor.js View on Github external
Cursor.prototype.close = function(callback) {
  var self = this
  this.getMoreTimer && clearTimeout(this.getMoreTimer);
  // Close the cursor if not needed
  if(this.cursorId instanceof Long && this.cursorId.greaterThan(Long.fromInt(0))) {
    try {
      var command = new KillCursorCommand(this.db, [this.cursorId]);
      // Added an empty callback to ensure we don't throw any null exceptions
      this.db._executeQueryCommand(command, {read:self.read, raw:self.raw, connection:self.connection});
    } catch(err) {}
  }

  // Null out the connection
  self.connection = null;
  // Reset cursor id
  this.cursorId = Long.fromInt(0);
  // Set to closed status
  this.state = Cursor.CLOSED;

  if(callback) {
    callback(null, self);
github linxixuan / linxixuan-blog / node_modules / mongoose / node_modules / mongodb / lib / mongodb / cursor.js View on Github external
this.returnKey = options.returnKey;
  this.maxScan = options.maxScan;
  this.min = options.min;
  this.max = options.max;
  this.showDiskLoc = options.showDiskLoc;
  this.comment = options.comment;
  this.tailableRetryInterval = options.tailableRetryInterval || 100;
  this.exhaust = options.exhaust || false;
  this.partial = options.partial || false;
  this.slaveOk = options.slaveOk || false;
  this.maxTimeMSValue = options.maxTimeMS;
  this.connection = options.connection;

  this.totalNumberOfRecords = 0;
  this.items = [];
  this.cursorId = Long.fromInt(0);

  // This name
  this.dbName = options.dbName;

  // State variables for the cursor
  this.state = Cursor.INIT;
  // Keep track of the current query run
  this.queryRun = false;
  this.getMoreTimer = false;

  // If we are using a specific db execute against it
  if(this.dbName != null) {
    this.collectionName = this.dbName + "." + this.collection.collectionName;
  } else {
    this.collectionName = (this.db.databaseName ? this.db.databaseName + "." : '') + this.collection.collectionName;
  }
github andreirtaylor / BoardGameTracking / node_modules / mongodb / lib / mongodb / command_cursor.js View on Github external
this.close = function(callback) {
    // Close the cursor if not needed
    if(cursorId instanceof Long && cursorId.greaterThan(Long.fromInt(0))) {
      try {
        var command = new KillCursorCommand(this.db, [cursorId]);
        // Added an empty callback to ensure we don't throw any null exceptions
        db._executeQueryCommand(command, {connection:connection});
      } catch(err) {}
    }

    // Null out the connection
    connection = null;
    // Reset cursor id
    cursorId = Long.fromInt(0);
    // Set to closed status
    state = 'closed';
    // Clear out all the items
    items = null;
github andreirtaylor / BoardGameTracking / node_modules / mongodb / lib / mongodb / cursor.js View on Github external
Cursor.prototype.close = function(callback) {
  var self = this
  this.getMoreTimer && clearTimeout(this.getMoreTimer);
  // Close the cursor if not needed
  if(this.cursorId instanceof Long && this.cursorId.greaterThan(Long.fromInt(0))) {
    try {
      var command = new KillCursorCommand(this.db, [this.cursorId]);
      // Added an empty callback to ensure we don't throw any null exceptions
      this.db._executeQueryCommand(command, {readPreference:self.readPreference, raw:self.raw, connection:self.connection});
    } catch(err) {}
  }

  // Null out the connection
  self.connection = null;
  // Reset cursor id
  this.cursorId = Long.fromInt(0);
  // Set to closed status
  this.state = Cursor.CLOSED;

  if(callback) {
    callback(null, self);
    self.items = [];
  }

  return this;
};
github mongodb / node-mongodb-native / lib / mongodb / command_cursor.js View on Github external
var CommandCursor = function(db, collection, command, options) {  
  // Ensure empty options if no options passed
  options = options || {};  
  
  // Default cursor id is 0
  var cursorId = Long.fromInt(0);
  var zeroCursor = Long.fromInt(0);
  var state = 'init';

  // Hardcode batch size
  command.cursor.batchSize = 1;

  // BatchSize
  var batchSize = command.cursor.batchSize || 0;
  var raw = options.raw || false;
  var readPreference = options.readPreference || 'primary';

  // Checkout a connection
  var connection = db.serverConfig.checkoutReader(readPreference);
  // MaxTimeMS
  var maxTimeMS = options.maxTimeMS;
github hyperstudio / MIT-Annotation-Data-Store / node_modules / mongoose / node_modules / mongodb / lib / mongodb / cursor.js View on Github external
Cursor.prototype.close = function(callback) {
  var self = this
  this.getMoreTimer && clearTimeout(this.getMoreTimer);
  // Close the cursor if not needed
  if(this.cursorId instanceof Long && this.cursorId.greaterThan(Long.fromInt(0))) {
    try {
      var command = new KillCursorCommand(this.db, [this.cursorId]);
      // Added an empty callback to ensure we don't throw any null exceptions
      this.db._executeQueryCommand(command, {read:self.read, raw:self.raw, connection:self.connection}, function() {});
    } catch(err) {}
  }

  // Null out the connection
  self.connection = null;
  // Reset cursor id
  this.cursorId = Long.fromInt(0);
  // Set to closed status
  this.state = Cursor.CLOSED;

  if(callback) {
    callback(null, self);
    self.items = [];
  }

  return this;
};
github onehilltech / blueprint / packages / blueprint-gatekeeper / node_modules / mongoose / node_modules / mongodb / lib / mongodb / command_cursor.js View on Github external
var CommandCursor = function(db, collection, command, options) {  
  var self = this;
  // Ensure empty options if no options passed
  options = options || {};  
  
  // Set up
  Readable.call(this, {objectMode: true});

  // Default cursor id is 0
  var cursorId = options.cursorId || Long.fromInt(0);
  var zeroCursor = Long.fromInt(0);
  var state = 'init';
  var batchSize = options.batchSize || 0;

  // Hardcode batch size
  if(command && command.cursor) {
    batchSize = command.cursor.batchSize || 0;
  }

  // BatchSize
  var raw = options.raw || false;
  var readPreference = options.readPreference || 'primary';

  // Cursor namespace
  this.ns = db.databaseName + "." + collection.collectionName

  // Checkout a connection
github onehilltech / blueprint / packages / blueprint-gatekeeper / node_modules / mongoose / node_modules / mongodb / lib / mongodb / cursor.js View on Github external
this.maxScan = options.maxScan;
  this.min = options.min;
  this.max = options.max;
  this.showDiskLoc = options.showDiskLoc;
  this.comment = options.comment;
  this.tailableRetryInterval = options.tailableRetryInterval || 100;
  this.exhaust = options.exhaust || false;
  this.partial = options.partial || false;
  this.slaveOk = options.slaveOk || false;
  this.maxTimeMSValue = options.maxTimeMS;
  this.connection = options.connection;
  this.transforms = options.transforms;

  this.totalNumberOfRecords = 0;
  this.items = [];
  this.cursorId = Long.fromInt(0);

  // This name
  this.dbName = options.dbName;

  // State variables for the cursor
  this.state = Cursor.INIT;
  // Keep track of the current query run
  this.queryRun = false;
  this.getMoreTimer = false;

  // If we are using a specific db execute against it
  if(this.dbName != null) {
    this.collectionName = this.dbName + "." + this.collection.collectionName;
  } else {
    this.collectionName = (this.db.databaseName ? this.db.databaseName + "." : '') + this.collection.collectionName;
  }
github Hanul / UPPERCASE / UPPERCASE-DB / node_modules / mongodb / lib / mongodb / command_cursor.js View on Github external
this.close = function(callback) {
    // Close the cursor if not needed
    if(cursorId instanceof Long && cursorId.greaterThan(Long.fromInt(0))) {
      try {
        var command = new KillCursorCommand(this.db, [cursorId]);
        // Added an empty callback to ensure we don't throw any null exceptions
        db._executeQueryCommand(command, {connection:connection});
      } catch(err) {}
    }

    // Null out the connection
    connection = null;
    // Reset cursor id
    cursorId = Long.fromInt(0);
    // Set to closed status
    state = 'closed';
    // Clear out all the items
    items = null;

    if(callback) {
      callback(null, null);
    }    
  }