bson 5.0.0-alpha.0 → 5.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -253,6 +253,7 @@ function isDate(d) {
253
253
  return Object.prototype.toString.call(d) === '[object Date]';
254
254
  }
255
255
 
256
+ const BSON_MAJOR_VERSION = 5;
256
257
  const BSON_INT32_MAX = 0x7fffffff;
257
258
  const BSON_INT32_MIN = -0x80000000;
258
259
  const BSON_INT64_MAX = Math.pow(2, 63) - 1;
@@ -311,7 +312,7 @@ class Binary {
311
312
  return 'Binary';
312
313
  }
313
314
  get [Symbol.for('@@mdb.bson.version')]() {
314
- return 5;
315
+ return BSON_MAJOR_VERSION;
315
316
  }
316
317
  constructor(buffer, subType) {
317
318
  if (!(buffer == null) &&
@@ -485,7 +486,7 @@ Binary.SUBTYPE_USER_DEFINED = 128;
485
486
  const UUID_BYTE_LENGTH = 16;
486
487
  class UUID extends Binary {
487
488
  get [Symbol.for('@@mdb.bson.version')]() {
488
- return 5;
489
+ return BSON_MAJOR_VERSION;
489
490
  }
490
491
  constructor(input) {
491
492
  let bytes;
@@ -596,7 +597,7 @@ class Code {
596
597
  return 'Code';
597
598
  }
598
599
  get [Symbol.for('@@mdb.bson.version')]() {
599
- return 5;
600
+ return BSON_MAJOR_VERSION;
600
601
  }
601
602
  constructor(code, scope) {
602
603
  this.code = code.toString();
@@ -640,7 +641,7 @@ class DBRef {
640
641
  return 'DBRef';
641
642
  }
642
643
  get [Symbol.for('@@mdb.bson.version')]() {
643
- return 5;
644
+ return BSON_MAJOR_VERSION;
644
645
  }
645
646
  constructor(collection, oid, db, fields) {
646
647
  const parts = collection.split('.');
@@ -716,7 +717,7 @@ class Long {
716
717
  return 'Long';
717
718
  }
718
719
  get [Symbol.for('@@mdb.bson.version')]() {
719
- return 5;
720
+ return BSON_MAJOR_VERSION;
720
721
  }
721
722
  get __isLong__() {
722
723
  return true;
@@ -1404,7 +1405,7 @@ class Decimal128 {
1404
1405
  return 'Decimal128';
1405
1406
  }
1406
1407
  get [Symbol.for('@@mdb.bson.version')]() {
1407
- return 5;
1408
+ return BSON_MAJOR_VERSION;
1408
1409
  }
1409
1410
  constructor(bytes) {
1410
1411
  if (typeof bytes === 'string') {
@@ -1833,7 +1834,7 @@ class Double {
1833
1834
  return 'Double';
1834
1835
  }
1835
1836
  get [Symbol.for('@@mdb.bson.version')]() {
1836
- return 5;
1837
+ return BSON_MAJOR_VERSION;
1837
1838
  }
1838
1839
  constructor(value) {
1839
1840
  if (value instanceof Number) {
@@ -1887,7 +1888,7 @@ class Int32 {
1887
1888
  return 'Int32';
1888
1889
  }
1889
1890
  get [Symbol.for('@@mdb.bson.version')]() {
1890
- return 5;
1891
+ return BSON_MAJOR_VERSION;
1891
1892
  }
1892
1893
  constructor(value) {
1893
1894
  if (value instanceof Number) {
@@ -1925,7 +1926,7 @@ class MaxKey {
1925
1926
  return 'MaxKey';
1926
1927
  }
1927
1928
  get [Symbol.for('@@mdb.bson.version')]() {
1928
- return 5;
1929
+ return BSON_MAJOR_VERSION;
1929
1930
  }
1930
1931
  toExtendedJSON() {
1931
1932
  return { $maxKey: 1 };
@@ -1946,7 +1947,7 @@ class MinKey {
1946
1947
  return 'MinKey';
1947
1948
  }
1948
1949
  get [Symbol.for('@@mdb.bson.version')]() {
1949
- return 5;
1950
+ return BSON_MAJOR_VERSION;
1950
1951
  }
1951
1952
  toExtendedJSON() {
1952
1953
  return { $minKey: 1 };
@@ -1970,7 +1971,7 @@ class ObjectId {
1970
1971
  return 'ObjectId';
1971
1972
  }
1972
1973
  get [Symbol.for('@@mdb.bson.version')]() {
1973
- return 5;
1974
+ return BSON_MAJOR_VERSION;
1974
1975
  }
1975
1976
  constructor(inputId) {
1976
1977
  let workingId;
@@ -2303,7 +2304,7 @@ class BSONRegExp {
2303
2304
  return 'BSONRegExp';
2304
2305
  }
2305
2306
  get [Symbol.for('@@mdb.bson.version')]() {
2306
- return 5;
2307
+ return BSON_MAJOR_VERSION;
2307
2308
  }
2308
2309
  constructor(pattern, options) {
2309
2310
  this.pattern = pattern;
@@ -2364,7 +2365,7 @@ class BSONSymbol {
2364
2365
  return 'BSONSymbol';
2365
2366
  }
2366
2367
  get [Symbol.for('@@mdb.bson.version')]() {
2367
- return 5;
2368
+ return BSON_MAJOR_VERSION;
2368
2369
  }
2369
2370
  constructor(value) {
2370
2371
  this.value = value;
@@ -2398,7 +2399,7 @@ class Timestamp extends LongWithoutOverridesClass {
2398
2399
  return 'Timestamp';
2399
2400
  }
2400
2401
  get [Symbol.for('@@mdb.bson.version')]() {
2401
- return 5;
2402
+ return BSON_MAJOR_VERSION;
2402
2403
  }
2403
2404
  constructor(low) {
2404
2405
  if (low == null) {
@@ -3417,7 +3418,7 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
3417
3418
  else if (value._bsontype === 'Binary') {
3418
3419
  index = serializeBinary(buffer, key, value, index);
3419
3420
  }
3420
- else if (value._bsontype === 'Symbol') {
3421
+ else if (value._bsontype === 'BSONSymbol') {
3421
3422
  index = serializeSymbol(buffer, key, value, index);
3422
3423
  }
3423
3424
  else if (value._bsontype === 'DBRef') {
@@ -3512,7 +3513,7 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
3512
3513
  else if (value._bsontype === 'Binary') {
3513
3514
  index = serializeBinary(buffer, key, value, index);
3514
3515
  }
3515
- else if (value._bsontype === 'Symbol') {
3516
+ else if (value._bsontype === 'BSONSymbol') {
3516
3517
  index = serializeSymbol(buffer, key, value, index);
3517
3518
  }
3518
3519
  else if (value._bsontype === 'DBRef') {
@@ -3613,7 +3614,7 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
3613
3614
  else if (value._bsontype === 'Binary') {
3614
3615
  index = serializeBinary(buffer, key, value, index);
3615
3616
  }
3616
- else if (value._bsontype === 'Symbol') {
3617
+ else if (value._bsontype === 'BSONSymbol') {
3617
3618
  index = serializeSymbol(buffer, key, value, index);
3618
3619
  }
3619
3620
  else if (value._bsontype === 'DBRef') {