How to use the bson.pure 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 zeit / pkg / test / test-79-npm / bson / bson@0.2.22.js View on Github external
'use strict';

var bson = require('bson');

var pure = {};
pure.Long = bson.pure().Long;
pure.doc = { long: pure.Long.fromNumber(100) };
pure.BSON = bson.pure().BSON;
pure.obj = new (pure.BSON)();
pure.data = pure.obj.serialize(pure.doc, false, true, false);
pure.doc2 = pure.obj.deserialize(pure.data);

var natv = {};
natv.Long = bson.native().Long;
natv.doc = { long: natv.Long.fromNumber(200) };
natv.BSON = bson.native().BSON;
natv.obj = new (natv.BSON)();
natv.data = natv.obj.serialize(natv.doc, false, true, false);
natv.doc2 = natv.obj.deserialize(natv.data);

if (pure.doc2.long === 100) {
  if (natv.doc2.long === 200) {
    console.log('ok');
  }
github zeit / pkg / test / test-79-npm / bson / bson@0.2.22.js View on Github external
'use strict';

var bson = require('bson');

var pure = {};
pure.Long = bson.pure().Long;
pure.doc = { long: pure.Long.fromNumber(100) };
pure.BSON = bson.pure().BSON;
pure.obj = new (pure.BSON)();
pure.data = pure.obj.serialize(pure.doc, false, true, false);
pure.doc2 = pure.obj.deserialize(pure.data);

var natv = {};
natv.Long = bson.native().Long;
natv.doc = { long: natv.Long.fromNumber(200) };
natv.BSON = bson.native().BSON;
natv.obj = new (natv.BSON)();
natv.data = natv.obj.serialize(natv.doc, false, true, false);
natv.doc2 = natv.obj.deserialize(natv.data);

if (pure.doc2.long === 100) {
  if (natv.doc2.long === 200) {
github nodulusteam / nodulus / server / node_modules / mongodb-core / lib / topologies / replset.js View on Github external
ReplSet.prototype.setBSONParserType = function(type) {
  var nBSON = null;

  if(type == 'c++') {
    nBSON = require('bson').native().BSON;
  } else if(type == 'js') {
    nBSON = require('bson').pure().BSON;
  } else {
    throw new MongoError(f("% parser not supported", type));
  }

  this.s.options.bson = new nBSON(bsonTypes);
}
github Hanul / UPPERCASE / UPPERCASE-DB / node_modules / mongodb-core / lib / topologies / mongos.js View on Github external
Mongos.prototype.setBSONParserType = function(type) {
  var nBSON = null;

  if(type == 'c++') {
    nBSON = require('bson').native().BSON;
  } else if(type == 'js') {
    nBSON = require('bson').pure().BSON;
  } else {
    throw new MongoError(f("% parser not supported", type));
  }

  this.s.options.bson = new nBSON(bsonTypes);
}
github Webschool-io / be-mean / sistema / modelagem / node_modules / mongoose / node_modules / mongodb / node_modules / mongodb-core / lib / topologies / server.js View on Github external
Server.prototype.setBSONParserType = function(type) {
  var nBSON = null;

  if(type == 'c++') {
    nBSON = require('bson').native().BSON;
  } else if(type == 'js') {
    nBSON = require('bson').pure().BSON;
  } else {
    throw new MongoError(f("% parser not supported", type));
  }

  this.s.options.bson = new nBSON(bsonTypes);
}
github pRivAte12 / Eduino / node_modules / mongoose / node_modules / mongodb / node_modules / mongodb-core / lib / topologies / server.js View on Github external
Server.prototype.setBSONParserType = function(type) {
  var nBSON = null;

  if(type == 'c++') {
    nBSON = require('bson').native().BSON;
  } else if(type == 'js') {
    nBSON = require('bson').pure().BSON;
  } else {
    throw new MongoError(f("% parser not supported", type));
  }

  this.s.options.bson = new nBSON(bsonTypes);
}
github Hanul / UPPERCASE / UPPERCASE-DB / node_modules / mongodb-core / lib / topologies / replset.js View on Github external
ReplSet.prototype.setBSONParserType = function(type) {
  var nBSON = null;

  if(type == 'c++') {
    nBSON = require('bson').native().BSON;
  } else if(type == 'js') {
    nBSON = require('bson').pure().BSON;
  } else {
    throw new MongoError(f("% parser not supported", type));
  }

  this.s.options.bson = new nBSON(bsonTypes);
}
github gaoxiaoliangz / readr / node_modules / mongodb / node_modules / mongodb-core / lib / topologies / server.js View on Github external
Server.prototype.setBSONParserType = function(type) {
  var nBSON = null;

  if(type == 'c++') {
    nBSON = require('bson').native().BSON;
  } else if(type == 'js') {
    nBSON = require('bson').pure().BSON;
  } else {
    throw new MongoError(f("% parser not supported", type));
  }

  this.s.options.bson = new nBSON(bsonTypes);
}
github debitoor / mongopatch / source / streams.js View on Github external
var fs = require('fs');
var util = require('util');
var path = require('path');

var async = require('async');
var streams = require('stream-wrapper');
var parallel = require('parallel-transform');
var speedometer = require('speedometer');
var stringify = require('json-stable-stringify');
var bson = new (require('bson').pure().BSON)();
var mongojs = require('mongojs');
var traverse = require('traverse');

var diff = require('./diff');

var DEFAULT_CONCURRENCY = 1;
var ATTEMPT_LIMIT = 5;

var JSON_STRINGIFY_SOURCE = fs.readFileSync(require.resolve('json-stable-stringify'), 'utf-8');
var COMPARE_TEMPLATE = fs.readFileSync(path.join(__dirname, 'compare.js.txt'), 'utf-8');

var bsonCopy = function(obj) {
	return bson.deserialize(bson.serialize(obj));
};

var extend = function(dest, src) {
github pRivAte12 / Eduino / node_modules / mongoose / node_modules / mongodb / node_modules / mongodb-core / lib / topologies / mongos.js View on Github external
Mongos.prototype.setBSONParserType = function(type) {
  var nBSON = null;

  if(type == 'c++') {
    nBSON = require('bson').native().BSON;
  } else if(type == 'js') {
    nBSON = require('bson').pure().BSON;
  } else {
    throw new MongoError(f("% parser not supported", type));
  }

  this.s.options.bson = new nBSON(bsonTypes);
}