How to use the Binary function from bson

Find comprehensive JavaScript bson.Binary code examples handpicked from public code repositorys.

2
3
4
5
6
7
8
9
10
11
const expect = require('chai').expect;
const bson = require('bson');
const ObjectId = bson.ObjectId;
const MinKey = bson.MinKey;
const MaxKey = bson.MaxKey;
const Binary = bson.Binary;
const BSONRegExp = bson.BSONRegExp;
const Code = bson.Code;
const Timestamp = bson.Timestamp;
const Long = bson.Long;
fork icon121
star icon761
watch icon0

+ 7 other calls in file

38
39
40
41
42
43
44
45
46
47
48
module.exports.BSON_BINARY_SUBTYPE_MD5 = 5;
module.exports.BSON_BINARY_SUBTYPE_ENCRYPTED = 6;
module.exports.BSON_BINARY_SUBTYPE_USER_DEFINED = 128;


/** @type {import('bson').Binary} */
module.exports.Binary = BSONJS.Binary;
/** @type {import('bson').Code} */
module.exports.Code = BSONJS.Code;
/** @type {import('bson').DBRef} */
module.exports.DBRef = BSONJS.DBRef;
fork icon0
star icon0
watch icon0

+ 12 other calls in file

356
357
358
359
360
361
362
363
364
365
let json = {};
let data;
if (storageDoc) {
    json = BSON.deserialize(storageDoc.data.buffer);
    json[key] = value;
    storageDoc.data = new BSON.Binary(BSON.serialize(json));
    data = storageDoc.data;
} else {
    json[key] = value;
    data = new BSON.Binary(BSON.serialize(json));
fork icon0
star icon0
watch icon0

+ 2 other calls in file