Module basic module

Module bson

bson encoding and decoding module

Reference method:

1 2
var encoding = require('encoding'); var bson = encoding.bson;

or

1
var bson = require('bson');

Static function

encode

Encode variables in bson format

1
static Buffer bson.encode(Object data);

Call parameters:

  • data : Object, the variable to be encoded

Return result:

  • Buffer , returns the encoded binary data

decode

Decode the string into a variable in bson way

1
static Object bson.decode(Buffer data);

Call parameters:

  • data : Buffer , the binary data to be decoded

Return result:

  • Object , returns the decoded variable