mongoose 8.18.2 → 8.18.3
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.
- package/lib/connection.js +1 -1
- package/lib/helpers/query/castUpdate.js +3 -3
- package/lib/mongoose.js +2 -2
- package/package.json +1 -1
- package/types/query.d.ts +3 -1
package/lib/connection.js
CHANGED
|
@@ -1025,7 +1025,7 @@ Connection.prototype.onOpen = function() {
|
|
|
1025
1025
|
* @param {Boolean} [options.bufferCommands=true] Mongoose specific option. Set to false to [disable buffering](https://mongoosejs.com/docs/faq.html#callback_never_executes) on all models associated with this connection.
|
|
1026
1026
|
* @param {Number} [options.bufferTimeoutMS=10000] Mongoose specific option. If `bufferCommands` is true, Mongoose will throw an error after `bufferTimeoutMS` if the operation is still buffered.
|
|
1027
1027
|
* @param {String} [options.dbName] The name of the database we want to use. If not provided, use database name from connection string.
|
|
1028
|
-
* @param {String} [options.user] username for authentication, equivalent to `options.auth.
|
|
1028
|
+
* @param {String} [options.user] username for authentication, equivalent to `options.auth.username`. Maintained for backwards compatibility.
|
|
1029
1029
|
* @param {String} [options.pass] password for authentication, equivalent to `options.auth.password`. Maintained for backwards compatibility.
|
|
1030
1030
|
* @param {Number} [options.maxPoolSize=100] The maximum number of sockets the MongoDB driver will keep open for this connection. Keep in mind that MongoDB only allows one operation per socket at a time, so you may want to increase this if you find you have a few slow queries that are blocking faster queries from proceeding. See [Slow Trains in MongoDB and Node.js](https://thecodebarbarian.com/slow-trains-in-mongodb-and-nodejs).
|
|
1031
1031
|
* @param {Number} [options.minPoolSize=0] The minimum number of sockets the MongoDB driver will keep open for this connection. Keep in mind that MongoDB only allows one operation per socket at a time, so you may want to increase this if you find you have a few slow queries that are blocking faster queries from proceeding. See [Slow Trains in MongoDB and Node.js](https://thecodebarbarian.com/slow-trains-in-mongodb-and-nodejs).
|
|
@@ -213,9 +213,9 @@ function castPipelineOperator(op, val) {
|
|
|
213
213
|
* @api private
|
|
214
214
|
*/
|
|
215
215
|
|
|
216
|
-
function walkUpdatePath(schema, obj, op, options, context, filter,
|
|
216
|
+
function walkUpdatePath(schema, obj, op, options, context, filter, prefix) {
|
|
217
217
|
const strict = options.strict;
|
|
218
|
-
|
|
218
|
+
prefix = prefix ? prefix + '.' : '';
|
|
219
219
|
const keys = Object.keys(obj);
|
|
220
220
|
let i = keys.length;
|
|
221
221
|
let hasKeys = false;
|
|
@@ -380,7 +380,7 @@ function walkUpdatePath(schema, obj, op, options, context, filter, pref) {
|
|
|
380
380
|
}
|
|
381
381
|
} else {
|
|
382
382
|
const checkPath = (key === '$each' || key === '$or' || key === '$and' || key === '$in') ?
|
|
383
|
-
|
|
383
|
+
prefix : prefix + key;
|
|
384
384
|
schematype = schema._getSchema(checkPath);
|
|
385
385
|
|
|
386
386
|
// You can use `$setOnInsert` with immutable keys
|
package/lib/mongoose.js
CHANGED
|
@@ -368,7 +368,7 @@ Mongoose.prototype.get = Mongoose.prototype.set;
|
|
|
368
368
|
* @param {Object} [options] passed down to the [MongoDB driver's `connect()` function](https://mongodb.github.io/node-mongodb-native/4.9/interfaces/MongoClientOptions.html), except for 4 mongoose-specific options explained below.
|
|
369
369
|
* @param {Boolean} [options.bufferCommands=true] Mongoose specific option. Set to false to [disable buffering](https://mongoosejs.com/docs/faq.html#callback_never_executes) on all models associated with this connection.
|
|
370
370
|
* @param {String} [options.dbName] The name of the database you want to use. If not provided, Mongoose uses the database name from connection string.
|
|
371
|
-
* @param {String} [options.user] username for authentication, equivalent to `options.auth.
|
|
371
|
+
* @param {String} [options.user] username for authentication, equivalent to `options.auth.username`. Maintained for backwards compatibility.
|
|
372
372
|
* @param {String} [options.pass] password for authentication, equivalent to `options.auth.password`. Maintained for backwards compatibility.
|
|
373
373
|
* @param {Boolean} [options.autoIndex=true] Mongoose-specific option. Set to false to disable automatic index creation for all models associated with this connection.
|
|
374
374
|
* @param {Class} [options.promiseLibrary] Sets the [underlying driver's promise library](https://mongodb.github.io/node-mongodb-native/4.9/interfaces/MongoClientOptions.html#promiseLibrary).
|
|
@@ -420,7 +420,7 @@ Mongoose.prototype.createConnection = function createConnection(uri, options) {
|
|
|
420
420
|
* @param {Boolean} [options.bufferCommands=true] Mongoose specific option. Set to false to [disable buffering](https://mongoosejs.com/docs/faq.html#callback_never_executes) on all models associated with this connection.
|
|
421
421
|
* @param {Number} [options.bufferTimeoutMS=10000] Mongoose specific option. If `bufferCommands` is true, Mongoose will throw an error after `bufferTimeoutMS` if the operation is still buffered.
|
|
422
422
|
* @param {String} [options.dbName] The name of the database we want to use. If not provided, use database name from connection string.
|
|
423
|
-
* @param {String} [options.user] username for authentication, equivalent to `options.auth.
|
|
423
|
+
* @param {String} [options.user] username for authentication, equivalent to `options.auth.username`. Maintained for backwards compatibility.
|
|
424
424
|
* @param {String} [options.pass] password for authentication, equivalent to `options.auth.password`. Maintained for backwards compatibility.
|
|
425
425
|
* @param {Number} [options.maxPoolSize=100] The maximum number of sockets the MongoDB driver will keep open for this connection. Keep in mind that MongoDB only allows one operation per socket at a time, so you may want to increase this if you find you have a few slow queries that are blocking faster queries from proceeding. See [Slow Trains in MongoDB and Node.js](https://thecodebarbarian.com/slow-trains-in-mongodb-and-nodejs).
|
|
426
426
|
* @param {Number} [options.minPoolSize=0] The minimum number of sockets the MongoDB driver will keep open for this connection.
|
package/package.json
CHANGED
package/types/query.d.ts
CHANGED
|
@@ -31,7 +31,9 @@ declare module 'mongoose' {
|
|
|
31
31
|
| 'strictQuery'
|
|
32
32
|
| 'translateAliases';
|
|
33
33
|
|
|
34
|
-
type MongooseBaseQueryOptions<DocType = unknown> = Pick<QueryOptions<DocType>, MongooseBaseQueryOptionKeys
|
|
34
|
+
type MongooseBaseQueryOptions<DocType = unknown> = Pick<QueryOptions<DocType>, MongooseBaseQueryOptionKeys | 'timestamps' | 'lean'> & {
|
|
35
|
+
[other: string]: any;
|
|
36
|
+
};
|
|
35
37
|
|
|
36
38
|
type MongooseUpdateQueryOptions<DocType = unknown> = Pick<QueryOptions<DocType>, MongooseBaseQueryOptionKeys | 'timestamps'>;
|
|
37
39
|
|