Commit Graph

28 Commits

Author SHA1 Message Date
Jack Bates
7c54e54ec8
[bson] Remove unused lint exceptions (#48031) 2020-09-23 13:36:58 -07:00
Wesley Wigham
6970a8fffa
#no-publishing-comment No more tabs in json documents, trailing newlines for every document 2020-05-15 12:27:10 -07:00
Wesley Wigham
048aefafaa
Eliminate all tabs 2020-05-14 19:20:31 -07:00
Mikael Lirbank
6e9f8d6434
Add 'value' property to Double class (#43003) 2020-03-19 15:16:09 -07:00
Gabriela Araujo Britto
e980ea529f
Update tslint configs (#42555)
* Update tslint configs

* Update npm-naming configs

* Fix some configs

#no-publishing-comment
2020-02-24 16:06:03 -08:00
Igor Gassmann
26f455ddc7 Remove deprecation annotation for DBRef (#40490)
DBRef is currently not deprecated http://mongodb.github.io/node-mongodb-native/3.2/api/DBRef.html
2019-11-19 11:37:14 -08:00
Nathan Shively-Sanders
64fc88601e
Disable npm-naming with dt-header (#34112)
npm-naming is a new rule but the code it runs was already disabled
whenever dt-header was disabled. This change keeps the behaviour the
same.
2019-03-22 09:26:34 -07:00
Justin Grant
7806308542 Fixed indenting 2019-02-11 11:21:22 -08:00
Justin Grant
7adde68af3 Updated types to match library 4.0
* deprecated ObjectID (replaced with ObjectId)
* added types + tests for EJSON
* removed `class BSON` and updated tests
* added DeserializeOptions.allowObjectSmallerThanBufferSize
2019-02-10 12:24:20 -08:00
Andrey Tselishchev
960c7ef8a0 [@types/bson] Updated BSON types (#27259)
* `Binary`: Added `sub_type` property.
* `Code`: Added `code` and `scope` properties
* Added missing `Int32` type
* `Decimal128`: Added `bytes` property
* `BSONRegExp`: Added `pattern` and `options` properties
* `Symbol`: Added `valueOf()` method
2018-07-20 17:33:17 -07:00
Andrey Tselishchev
eb735f86b6 Update [@types/bson] to match js-bson@1.0.6 (#27098)
* [@types/bson] Updated BSON class definitions

* Updated BSON.serialize (changed the way how options are passed)
* Updated BSON.deserialize (added missing options, removed `isArray` argument)
* Added BSON.serializeWithBufferAndIndex
* Added BSON.deserializeStream

* [@types/bson] Updated BSON types

* Binary: Made static constants 'readonly', added comments
* ObjectID: 'equals' can accept string, added comments
* Code, DBRef, Double, Decimal128, MaxKey, MinKey, ObjectID, BSONRegExp, Symbol: Added comments

* [@types/bson] Updated Long & Timestamp BSON types

* In original js-node@1.0.x code 'Timestamp' is a 100% copy-paste of 'Long'
  with 'Long' replaced by 'Timestamp' (changed to inheritance in js-node@2.0.0).
  Do avoid duplication in typings a base class 'LongLike' was introduced and both 'Long'
  and 'Timestamp' are inherited from 'LongLike'.
* Made static constants 'readonly', fixed return-type for greaterThan and greaterThanOrEqual
  (boolean), renamed argument for shiftLeft, shiftRight, shiftRightUnsigned, added comments

* [@types/bson] Changed header version number to 1.0.6
2018-07-06 11:55:43 -07:00
Dobes Vandermeer
bdf4fc0819
Fix generate() return type
`ObjectID().generate()` returns a `Buffer`, not a `string`

@horiuchi @CaselIT

See https://github.com/mongodb/js-bson/blob/master/lib/bson/objectid.js#L149 for the source code of bson, excerpted here:

```
/**
 * Generate a 12 byte id buffer used in ObjectID's
 *
 * @method
 * @param {number} [time] optional parameter allowing to pass in a second based timestamp.
 * @return {Buffer} return the 12 byte id buffer string.
 */
ObjectID.prototype.generate = function(time) {
  if ('number' !== typeof time) {
    time = ~~(Date.now() / 1000);
  }

  // Use pid
  var pid =
    (typeof process === 'undefined' || process.pid === 1
      ? Math.floor(Math.random() * 100000)
      : process.pid) % 0xffff;
  var inc = this.get_inc();
  // Buffer used
  var buffer = new Buffer(12);
  // Encode time
  buffer[3] = time & 0xff;
  buffer[2] = (time >> 8) & 0xff;
  buffer[1] = (time >> 16) & 0xff;
  buffer[0] = (time >> 24) & 0xff;
  // Encode machine
  buffer[6] = MACHINE_ID & 0xff;
  buffer[5] = (MACHINE_ID >> 8) & 0xff;
  buffer[4] = (MACHINE_ID >> 16) & 0xff;
  // Encode pid
  buffer[8] = pid & 0xff;
  buffer[7] = (pid >> 8) & 0xff;
  // Encode index
  buffer[11] = inc & 0xff;
  buffer[10] = (inc >> 8) & 0xff;
  buffer[9] = (inc >> 16) & 0xff;
  // Return the buffer
  return buffer;
};
```
2018-06-14 14:57:05 -07:00
ramlez
775ade8fa6 [BSON] add types for missing calculateObjectSize method (#24901) 2018-04-11 12:08:06 -07:00
arusakov
e1aa4e4ce4 fix typo 2018-02-27 17:05:45 +03:00
arusakov
86cb9449d5 clear 2018-02-27 16:59:37 +03:00
arusakov
fd0ba37df7 bson: add cacheHexString boolean flag to ObjectID 2018-02-27 16:17:17 +03:00
Andy Hanson
45c9246c09 Remove esModuleInterop from tsconfigs (no longer mandatory) 2018-02-14 14:55:13 -08:00
Andy
bef4d2b27d
Enable "esModuleInterop" in all tsconfigs (#23354) 2018-02-05 11:01:56 -08:00
Mine Starks
4b1218e007
Merge pull request #21787 from CaselIT/mongo-DBRef
[bson] Updated dbref and exported from mongodb.
2017-12-11 10:55:20 -08:00
Michał [Desktop]
2fb3aa3b2f [BSON]: Add buffer field to Binary 2017-11-28 22:16:50 +01:00
CaselIT
c4db7383b8 Updated dbref and exported from mongodb. https://github.com/DefinitelyTyped/DefinitelyTyped/issues/21717 2017-11-27 22:33:05 +01:00
Andy
19f89399e4 Ensure every package has a tslint.json (#21009)
* Ensure every package has a tslint.json

* Fixes
2017-10-25 11:13:50 -07:00
Andy
947a8fb761 Enable strictFunctionTypes (#20373) 2017-10-06 14:03:03 -07:00
Andy
924fafffc0 Fix remaining lint errors (#19166) 2017-08-20 15:37:53 -07:00
Fábio Batista
16be2fcb11 @types/{bson,mongodb,mongoose}: added Decimal128 type 2017-04-07 21:18:51 -03:00
Federico Caselli
f54704a9eb Added missing bson methods and removed duplication on mongodb 2017-03-31 13:42:17 +02:00
Sarun Rattanasiri
9b5ff60d92 add missing ObjectId methods to bson type definition 2017-03-27 01:03:48 +07:00
Andy Hanson
354cec620d Move all packages to a types directory 2017-03-24 14:27:52 -07:00