How to use the Int32 function from bson

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

8
9
10
11
12
13
14
15
16
17
18
const BSONRegExp = bson.BSONRegExp;
const Code = bson.Code;
const Timestamp = bson.Timestamp;
const Long = bson.Long;
const Double = bson.Double;
const Int32 = bson.Int32;
const Decimal128 = bson.Decimal128;
const TypeChecker = require('../');


describe('TypeChecker', function() {
fork icon121
star icon761
watch icon0

+ 7 other calls in file

351
352
353
354
355
356
357
358
359
360
});

context('when providing an int32', function() {
  it('correctly converts to Int32', function() {
    const stringified = parser.stringify({
      test: new bson.Int32(123)
    });
    assert.equal(stringified, "{test: NumberInt('123')}");
  });
});
fork icon9
star icon35
watch icon0

+ 3 other calls in file

48
49
50
51
52
53
54
55
56
57
/** @type {import('bson').Decimal128} */
module.exports.Decimal128 = BSONJS.Decimal128;
/** @type {import('bson').Double} */
module.exports.Double = BSONJS.Double;
/** @type {import('bson').Int32} */
module.exports.Int32 = BSONJS.Int32;
/** @type {import('bson').Long} */
module.exports.Long = BSONJS.Long;
/** @type {import('bson').Map} */
module.exports.Map = BSONJS.Map;
fork icon0
star icon0
watch icon0

+ 12 other calls in file

150
151
152
153
154
155
156
157
158
159
const name = `should respect bson options ${JSON.stringify(bsonOptions)}`;

it(name, metadata, function () {
  const data = {
    a: 12,
    b: new BSON.Int32(12),
    c: new BSON.Long(12),
    d: new BSON.Double(12),
    e: /[A-Za-z0-9]*/,
    f: new BSON.BSONRegExp('[A-Za-z0-9]*'),
fork icon0
star icon0
watch icon0

+ 3 other calls in file