All notable changes to this project will be documented in this file. See standard-version for commit guidelines.该项目的所有显著更改都将记录在该文件中。有关提交指南,请参阅标准版本。
^6.3.0 (#3983) (9401d09)awaited field to SDAM heartbeat events (#3895) (b50aadc)onKMSProvidersRefresh (#3787)mongodb-js/saslprep as a required dependency (#3815) (bd031fc)onKMSProvidersRefresh (#3787) (844aa52)upsertedId to be null in UpdateResult (#3631) (4b5be21)oplogReplay option as deprecated (#3337) (6c69b7d)comment field (#3167) (4e2f9bf)watch type parameter to extend ChangeStream type parameter (#3183) (43ba9fc)enableUtf8Validation option (#3074) (4f56409)GridFSBucketWriteStream.prototype.end() return this for compat with @types/node@17.0.6 (#3088) (7bb9e37)authorizedCollections option to the db.listCollections method (#3021) (e1234a7)defaultTransactionOptions with POJO rather than ReadConcern instance (#3032) (53b3164)| void in declaration of Promise overload of rename() (#2922) (58c1e84)db() before MongoClient is connected (#2889) (51ea86d)NODE-1502: command monitoring objects hold internal state references (#2832) (a2887db)
NODE-2026: SERVICE_REALM kerberos mechanism property not attached (#2865) (5caa354)
NODE-2035: exceptions thrown from awaited cursor forEach do not propagate (#2835) (ac49df6)
NODE-2905: support SERVICE_NAME authentication mechanism property (#2857) (dfb91b8)
NODE-3150: allow retrieving PCRE-style RegExp (ca9e2dc)
NODE-3272: emit correct event type when SRV Polling (#2825) (579119f)
NODE-3305: beforeHandshake flag is always true (#2854) (079bd6c)
NODE-3311: InsertOneOptions extends CommandOperationOptions (#2816) (734b481)
NODE-3335: do not validate explain verbosity in client (#2834) (1a57ba8)
NODE-3343: allow overriding result document after projection applied (#2856) (988f9c8)
NODE-3356: update redaction logic for command monitoring events (#2849) (536e5ff)
NODE-3291: Standardize error representation in the driver (#2824) (9608c6a)
remove strict/callback mode from Db.collection helper (#2817) (53abfe7)
NODE-2995: Add shared metadata MongoClient (#2772) (9073d54)
NODE-3074: update estimated document count for v1 api (#2764) (146791c)
NODE-3109: prevent servername from being an IP (#2771) (27089be)
NODE-3166: allowInvalidHostnames and allowInvalidCertificates flags are ignored (#2784) (a769cf8)
NODE-3174: Preserve sort key order for numeric string keys (#2788) (440de41)
NODE-3176: handle errors from MessageStream (#2780) (76b110e)
NODE-3194: Ignore undefined and null options in MongoClient constructor (#2800) (8bb92f9)
NODE-3197: revert setImmediate in waitQueue (#2802) (6c0dfef)
NODE-3206: Make distinct use any[] type instead of Document[] (#2795) (b45e3b3)
sdam: topology no longer causes close event (#2792) (6cd982f)
NODE-1812: replace returnOriginal with returnDocument option (#2803) (1cdc8a8)
NODE-3157: update find and modify interfaces for 4.0 (#2799) (29512da)
add FLE AWS sessionToken TypeScript definitions (#2737) (f4698b5)
remove catch for synchronous socket errors and remove validation on nodejs option (#2746) (a516903)
session support detection spec compliance [PORT: 4.0] (#2733) (1615be0)
createAutoEncrypter() functionality (#2710) (25ef870)checkKeys for insert operations (#2726) (5ce9b25)locale (#2727) (8a678e9)withReadConcern builder to AbstractCursor (#2645) (0cca729)tryNext method (#2638) (43c94b6)oplogReplay for find commands (24155e7)parallelCollectionScan helper (9dee21f)allowDiskUse for find commands (dbc0b37)allow event loop to process during wait queue processing (#2541) (7bbc783)
always clear cancelled wait queue members during processing (7e942ba)
always include writeErrors on a BulkWriteError instance (0759a0e)
assert update/replace atomic requirements in bulk operations (911c25d)
awaitable isMaster timeout must respect connectTimeoutMS (#2650) (8d44cc2)
change prepublishOnly npm script to prepare (95440fb)
clarify handle wrong set name single topology (93cd8b3)
connection leak if wait queue member cancelled (#2563) (4018a1e)
correct legacy require paths (f96a97f)
correct typeof check in checkSupportedServer (#2690) (421fe6e)
correctly re-establishes pipe destinations (#2592) (7d023a6)
correctly use template string for connection string error message (b4d89ea)
createCollection only uses listCollections in strict mode (ccccbc8)
db.command to not inherit options from parent (8f6c247)
don't depend on private node api for Timeout wrapper (e6dc1f4)
don't immediately schedule monitoring after streaming failure (7a3b99b)
don't reset monitor if we aren't streaming topology changes (2f23dd7)
don't try to calculate sMax if there are no viable servers (dd24cee)
ensure implicit sessions are ended consistently (1a443e7)
enumerate function override call signatures (#2687) (2492dd2)
error label checking & insertOne where retryWrites is false (d4502aa)
filter servers before applying reducers (99b86b3)
handle session with unacknowledged write (4aeaedf)
hint should raise error on unacknowledged writes (665b352)
honor journal=true in connection string (41d291a)
ignore ENOTFOUND during TXT record lookup (b1e15a8)
ingest WC as a simple object or number for w value (#2695) (f5f9fd4)
internal access modifier on symbol properties (#2664) (f6d9b81)
ipv6 is not supported when using dns service discovery (3cc53cb)
make MongoBulkWriteError conform to CRUD spec (#2621) (7aa3567)
make the owner property of ClientSessionOptions optional (#2656) (d811a01)
min and max take Document parameters, not numbers (#2657) (698533f)
move kerberos client setup from prepare to auth (#2655) (93ef9e8)
npm script check:test failure on ubuntu (addb4f5)
only consider MongoError subclasses for retryability (265fe40)
only force server id generation if requested (#2653) (577d6eb)
only use ServerDescription equality to prevent event emission (ddf151d)
pass optional promise lib to maybePromise (52be01f)
pass options into commandSupportsReadConcern (e855c83)
permit waking async interval with unreliable clock (#2551) (a2c113f)
prevent bulk operations from being executed multiple times (#2658) (bb883f7)
reduce default keepalive time to align with Azure defaults (ffc0f55)
remove check for NonResumableChangeStreamError label (7cf669d)
remove circular dependency warnings on node 14 (f32fa15)
removed geoNear deprecation (a3408e6)
SASL signature consists of the string representation of the payload (#2529) (e7d2693)
single readPreferenceTags should be parsed as an array (98e879d)
store name of collection for more informative error messages (979d41e)
support write concern provided as string in fromOptions (637f428)
ChangeStream: handle null changes (9db8369)
ChangeStream: make CursorNotFound error resumable (3d8ac55)
ChangeStream: should resume from errors when iterating (7a8a533)
ChangeStream: whitelist change stream resumable errors (f4bf912), closes #17 #18
ClientSession: correct toBSON TypeScript signature (#2686) (cc4b9e0)
writes within transactions are not retryable (08fd347)
cursor: transforms should only be applied once to documents (a52a860)
throw an error if allowDiskUse is used on MongoDB < 3.2 (ebeae56)
typings for readConcern (4f9d4ce)
unordered bulk write should attempt to execute all batches (fa07519)
use async interruptable interval for server monitoring (d792806)
sdam: use ObjectId comparison to track maxElectionId (db991d6)
use options for readPreference in client (800e71e)
use properly camel cased form of mapReduce for command (c1ed2c1)
use require instead of readFileSync for driver.version (#2652) (e7a42bb)
GridFS: emit error on bad options (21b8ae9)
GridFS: emit error on bad options (e11e573)
user roles take single string & DDL readPreference tests (98162c3)
warning message fix should not check for topology existence (f7094b2)
conform CRUD result types to specification (#2651) (0135e9e)
CreateIndexOp returns string, CreateIndexesOp returns array (#2666) (e12c485)
pull CursorStream out of Cursor (054838f)
remove deprecated Collection.group helper (cf5c865)
remove deprecated find options (0e6375a)
remove deprecated GridFS API (bee0aa2)
STATE_CLOSING before draining waitQueue (494dffb)hasNext on cursor (bb359a1)secureConnect for tls connections (f8bdb8d)ssl=true (c8d182e)ssl option to pool connection options (563ced6)updateRsFromPrimary (95a772e)connectTimeoutMS (c83af9a)timeout event (5319ff9)withConnection helper to the connection pool (d59dced)connectionId for APM with new CMAP connection pool (9bd360c)MongoServerSelectionError (0cf7ec9)Monitor type for server monitoring (2bfe2a1)initialize after session support check (e50c51a)roundTripTime (cb107a8)drain event for use with unified topology (da931ea)intervalMS (afb125f)MessageStream for streamed wire protocol messaging (8c44044)Connection replacement for CMAP (7890e48)initialize after session support check (3b076b3)drain event for use with unified topology (3471c28)DISCONNECTED if reconnect enabled (43d461e)topologyId for event emission (19549ff)minHeartbeatIntervalMS => minHeartbeatFrequencyMS (af9fb45)close every time a child server closes (818055a)nodejs (d126665)hint to all update methods (720f5e5)force parameter for topology close (d6e8936)close is emitted after last chunk (ae94cb9)full option was specified (95a7d05)mapReduce without inline (51a36f3)executeOperation for explain, if promise is desired (b4a7ad7)data-bearing type to ServerDescription (852e14f)known, data-bearing filters to TopologyDescription (d0ccb56)CommandOperationV2 (86f5ba5)Cursor or subclass (b78bb89)sslValidate is false (1f8e7fa)sslValidate is false (1f8e7fa)logout and print warning (542859d)close method (7c111e0)makeLazyLoader (050267d)$meta based sort when passing an array to sort() (f93a8c3)newClient (1dac18f)batchSize (ad10dee)resolveReadPreference for inheritance (a649e35)_id with background: true (b3ff3ed)endSessions is always skipped now (a276cbe)batchSize (ad10dee)resolveReadPreference for inheritance (a649e35)_id with background: true (b3ff3ed)endSessions is always skipped now (a276cbe)dropDatabase always uses primary read preference (e62e5c9)db is wrapped in parentheses (efa78f0)dbName property of collection (6fd05c1).connect method on replset and mongos has changed. You shouldn't have been using this anyway, but if you were, you only should pass options and callback.Part of NODE-1089
keepAlive is now split into boolean keepAlive and number keepAliveInitialDelayFixes NODE-998
cursor key is always present (f16f314)cursor info on pre-OP_QUERY responses (4242d49)noCursorTimeout as an option to find() (e9c4ffc)hasNext should propagate errors when using callback (6339625)null response for dead cursor (6aca2c5)connect (474ac65)afterClusterTime in readConcern (a9097f7)MongoClient.prototype.startSession (bce5adf)retryWrites cs option (2321870)ciphers and ecdhCurve (441b7b1)notEqual assertion (41d93fd)strictEqual assertion method (cad8e19)find and findOne no longer support the fields parameter. You can achieve the same results as the fields parameter by either using Cursor.prototype.project, or by passing the projection property in on the options object. Additionally, find does not support individual options like skip and limit as positional parameters. You must pass in these parameters in the options objectpromoteLongs from MongoClient's connectappname to list of valid option names_id (Issue #1517, https://github.com/vkarpov15).find().disconnected event?aliases option, always results in null value in GridFS files (Issue #1152, https://github.com/vsivsi)options.connectArbiter to decide connect arbiters or not (Issue #675)find({a:1}, {read:'primary'}).toArray(function(err, items) {});Reworked bson.js parser to get rid off Array.shift() due to it allocating new memory for each call. Speedup varies between 5-15% depending on doc
Reworked bson.cc to throw error when trying to serialize js bson types
Added MinKey, MaxKey and Double support for JS and C++ parser
Reworked socket handling code to emit errors on unparsable messages
Added logger option for Db class, lets you pass in a function in the shape { log : function(message, object) {}, error : function(errorMessage, errorObject) {}, debug : function(debugMessage, object) {}, }
Usage is new Db(new Server(..), {logger: loggerInstance})