mongoose 8.16.4 → 8.16.5
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/dist/browser.umd.js +1 -1
- package/lib/document.js +4 -0
- package/package.json +1 -1
- package/types/connection.d.ts +4 -0
- package/types/models.d.ts +11 -4
package/lib/document.js
CHANGED
|
@@ -2703,6 +2703,10 @@ function _getPathsToValidate(doc, pathsToValidate, pathsToSkip, isNestedValidate
|
|
|
2703
2703
|
if (!doc.$__isSelected(path) && !doc.$isModified(path)) {
|
|
2704
2704
|
return false;
|
|
2705
2705
|
}
|
|
2706
|
+
if (path.endsWith('.$*')) {
|
|
2707
|
+
// Skip $* paths - they represent map schemas, not actual document paths
|
|
2708
|
+
return false;
|
|
2709
|
+
}
|
|
2706
2710
|
if (doc.$__.cachedRequired != null && path in doc.$__.cachedRequired) {
|
|
2707
2711
|
return doc.$__.cachedRequired[path];
|
|
2708
2712
|
}
|
package/package.json
CHANGED
package/types/connection.d.ts
CHANGED
|
@@ -72,11 +72,15 @@ declare module 'mongoose' {
|
|
|
72
72
|
}[keyof SchemaMap];
|
|
73
73
|
|
|
74
74
|
class Connection extends events.EventEmitter implements SessionStarter {
|
|
75
|
+
/** Runs a [db-level aggregate()](https://www.mongodb.com/docs/manual/reference/method/db.aggregate/) on this connection's underlying `db` */
|
|
75
76
|
aggregate<ResultType = unknown>(pipeline?: PipelineStage[] | null, options?: AggregateOptions): Aggregate<Array<ResultType>>;
|
|
76
77
|
|
|
77
78
|
/** Returns a promise that resolves when this connection successfully connects to MongoDB */
|
|
78
79
|
asPromise(): Promise<this>;
|
|
79
80
|
|
|
81
|
+
/** The Mongoose instance this connection is associated with */
|
|
82
|
+
base: Mongoose;
|
|
83
|
+
|
|
80
84
|
bulkWrite<TSchemaMap extends Record<string, AnyObject>>(
|
|
81
85
|
ops: Array<ConnectionBulkWriteModel<TSchemaMap>>,
|
|
82
86
|
options: mongodb.ClientBulkWriteOptions & { ordered: false }
|
package/types/models.d.ts
CHANGED
|
@@ -23,7 +23,14 @@ declare module 'mongoose' {
|
|
|
23
23
|
): U;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
export type MongooseBulkWriteResult = mongodb.BulkWriteResult & {
|
|
27
|
+
mongoose?: {
|
|
28
|
+
validationErrors: Error[],
|
|
29
|
+
results: Array<Error | mongodb.WriteError | null>
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export interface MongooseBulkWriteOptions extends mongodb.BulkWriteOptions {
|
|
27
34
|
session?: ClientSession;
|
|
28
35
|
skipValidation?: boolean;
|
|
29
36
|
throwOnValidationError?: boolean;
|
|
@@ -308,18 +315,18 @@ declare module 'mongoose' {
|
|
|
308
315
|
bulkWrite<DocContents = TRawDocType>(
|
|
309
316
|
writes: Array<AnyBulkWriteOperation<DocContents extends Document ? any : (DocContents extends {} ? DocContents : any)>>,
|
|
310
317
|
options: MongooseBulkWriteOptions & { ordered: false }
|
|
311
|
-
): Promise<
|
|
318
|
+
): Promise<MongooseBulkWriteResult>;
|
|
312
319
|
bulkWrite<DocContents = TRawDocType>(
|
|
313
320
|
writes: Array<AnyBulkWriteOperation<DocContents extends Document ? any : (DocContents extends {} ? DocContents : any)>>,
|
|
314
321
|
options?: MongooseBulkWriteOptions
|
|
315
|
-
): Promise<
|
|
322
|
+
): Promise<MongooseBulkWriteResult>;
|
|
316
323
|
|
|
317
324
|
/**
|
|
318
325
|
* Sends multiple `save()` calls in a single `bulkWrite()`. This is faster than
|
|
319
326
|
* sending multiple `save()` calls because with `bulkSave()` there is only one
|
|
320
327
|
* network round trip to the MongoDB server.
|
|
321
328
|
*/
|
|
322
|
-
bulkSave(documents: Array<Document>, options?: MongooseBulkSaveOptions): Promise<
|
|
329
|
+
bulkSave(documents: Array<Document>, options?: MongooseBulkSaveOptions): Promise<MongooseBulkWriteResult>;
|
|
323
330
|
|
|
324
331
|
/** Collection the model uses. */
|
|
325
332
|
collection: Collection;
|