Skip to content

Commit

Permalink
fix(topology): include all BSON types in ctor for bson-ext support
Browse files Browse the repository at this point in the history
bson-ext requires a reference to all the BSON types in the
constructor in order to be able to call back into JavaScript during
serialization/deserialization.

NODE-2092
  • Loading branch information
mbroadst committed Oct 10, 2019
1 parent 6e2565e commit aa4c832
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
19 changes: 18 additions & 1 deletion lib/core/sdam/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,24 @@ class Server extends EventEmitter {
// the server logger
logger: Logger('Server', options),
// the bson parser
bson: options.bson || new BSON(),
bson:
options.bson ||
new BSON([
BSON.Binary,
BSON.Code,
BSON.DBRef,
BSON.Decimal128,
BSON.Double,
BSON.Int32,
BSON.Long,
BSON.Map,
BSON.MaxKey,
BSON.MinKey,
BSON.ObjectId,
BSON.BSONRegExp,
BSON.Symbol,
BSON.Timestamp
]),
// client metadata for the initial handshake
clientInfo: createClientInfo(options),
// state variable to determine if there is an active server check in progress
Expand Down
19 changes: 18 additions & 1 deletion lib/core/sdam/topology.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,24 @@ class Topology extends EventEmitter {
// allow users to override the cursor factory
Cursor: options.cursorFactory || CoreCursor,
// the bson parser
bson: options.bson || new BSON(),
bson:
options.bson ||
new BSON([
BSON.Binary,
BSON.Code,
BSON.DBRef,
BSON.Decimal128,
BSON.Double,
BSON.Int32,
BSON.Long,
BSON.Map,
BSON.MaxKey,
BSON.MinKey,
BSON.ObjectId,
BSON.BSONRegExp,
BSON.Symbol,
BSON.Timestamp
]),
// a map of server instances to normalized addresses
servers: new Map(),
// Server Session Pool
Expand Down

0 comments on commit aa4c832

Please sign in to comment.