Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose

Package Overview
Dependencies
Maintainers
4
Versions
903
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose - npm Package Compare versions

Comparing version 8.9.1 to 8.9.2

lib/helpers/indexes/isIndexSpecEqual.js

25

lib/aggregate.js

@@ -91,2 +91,20 @@ 'use strict';

/**
* Returns default options for this aggregate.
*
* @param {Model} model
* @api private
*/
Aggregate.prototype._optionsForExec = function() {
const options = this.options || {};
const asyncLocalStorage = this.model()?.db?.base.transactionAsyncLocalStorage?.getStore();
if (!options.hasOwnProperty('session') && asyncLocalStorage?.session != null) {
options.session = asyncLocalStorage.session;
}
return options;
};
/**
* Get/set the model that this aggregation will execute on.

@@ -918,2 +936,3 @@ *

Aggregate.prototype.cursor = function(options) {
this._optionsForExec();
this.options.cursor = options || {};

@@ -1027,6 +1046,3 @@ return new AggregationCursor(this); // return this;

const asyncLocalStorage = this.model()?.db?.base.transactionAsyncLocalStorage?.getStore();
if (!this.options.hasOwnProperty('session') && asyncLocalStorage?.session != null) {
this.options.session = asyncLocalStorage.session;
}
this._optionsForExec();

@@ -1058,2 +1074,3 @@ if (this.options && this.options.cursor) {

const options = clone(this.options || {});
let result;

@@ -1060,0 +1077,0 @@ try {

2

lib/connection.js

@@ -666,3 +666,3 @@ 'use strict';

* let doc = await Person.findOne({ name: 'Ned Stark' }, null, { session });
* await doc.remove();
* await doc.deleteOne();
* // `doc` will always be null, even if reading from a replica set

@@ -669,0 +669,0 @@ * // secondary. Without causal consistency, it is possible to

@@ -12,2 +12,3 @@ 'use strict';

const isBsonType = require('../helpers/isBsonType');
const cleanModifiedSubpaths = require('../helpers/document/cleanModifiedSubpaths');

@@ -161,3 +162,9 @@ const populateModelSymbol = require('../helpers/symbols').populateModelSymbol;

if (parent != null && parent.$__ != null && !deepEqual(value, priorVal)) {
parent.markModified(fullPath.call(this));
const path = fullPath.call(this);
parent.markModified(path);
// If overwriting the full document array or subdoc, make sure to clean up any paths that were modified
// before re: #15108
if (this.$__schemaType.$isMongooseDocumentArray || this.$__schemaType.$isSingleNested) {
cleanModifiedSubpaths(parent, path);
}
}

@@ -164,0 +171,0 @@

{
"name": "mongoose",
"description": "Mongoose MongoDB ODM",
"version": "8.9.1",
"version": "8.9.2",
"author": "Guillermo Rauch <guillermo@learnboost.com>",

@@ -6,0 +6,0 @@ "keywords": [

@@ -575,3 +575,4 @@ /// <reference path="./aggregate.d.ts" />

| typeof Schema.Types.Buffer
| typeof Schema.Types.ObjectId;
| typeof Schema.Types.ObjectId
| typeof Schema.Types.UUID;

@@ -716,8 +717,10 @@

*/
export type BufferToBinary<T> = T extends TreatAsPrimitives ? T : T extends Record<string, any> ? {
[K in keyof T]: T[K] extends Buffer
? mongodb.Binary
: T[K] extends (Buffer | null | undefined)
? mongodb.Binary | null | undefined
: T[K] extends Types.DocumentArray<infer ItemType>
export type BufferToBinary<T> = T extends Buffer
? mongodb.Binary
: T extends TreatAsPrimitives
? T
: T extends Record<string, any> ? {
[K in keyof T]: T[K] extends Buffer
? mongodb.Binary
: T[K] extends Types.DocumentArray<infer ItemType>
? Types.DocumentArray<BufferToBinary<ItemType>>

@@ -727,3 +730,3 @@ : T[K] extends Types.Subdocument<unknown, unknown, infer SubdocType>

: BufferToBinary<T[K]>;
} : T;
} : T;

@@ -733,13 +736,15 @@ /**

*/
export type BufferToJSON<T> = T extends TreatAsPrimitives ? T : T extends Record<string, any> ? {
[K in keyof T]: T[K] extends Buffer
? { type: 'buffer', data: number[] }
: T[K] extends (Buffer | null | undefined)
? { type: 'buffer', data: number[] } | null | undefined
: T[K] extends Types.DocumentArray<infer ItemType>
? Types.DocumentArray<BufferToBinary<ItemType>>
: T[K] extends Types.Subdocument<unknown, unknown, infer SubdocType>
? HydratedSingleSubdocument<SubdocType>
: BufferToBinary<T[K]>;
} : T;
export type BufferToJSON<T> = T extends Buffer
? { type: 'buffer', data: number[] }
: T extends TreatAsPrimitives
? T
: T extends Record<string, any> ? {
[K in keyof T]: T[K] extends Buffer
? { type: 'buffer', data: number[] }
: T[K] extends Types.DocumentArray<infer ItemType>
? Types.DocumentArray<BufferToBinary<ItemType>>
: T[K] extends Types.Subdocument<unknown, unknown, infer SubdocType>
? HydratedSingleSubdocument<SubdocType>
: BufferToBinary<T[K]>;
} : T;

@@ -749,13 +754,15 @@ /**

*/
export type ObjectIdToString<T> = T extends TreatAsPrimitives ? T : T extends Record<string, any> ? {
[K in keyof T]: T[K] extends mongodb.ObjectId
? string
: T[K] extends (mongodb.ObjectId | null | undefined)
? string | null | undefined
: T[K] extends Types.DocumentArray<infer ItemType>
? Types.DocumentArray<ObjectIdToString<ItemType>>
: T[K] extends Types.Subdocument<unknown, unknown, infer SubdocType>
? HydratedSingleSubdocument<ObjectIdToString<SubdocType>>
: ObjectIdToString<T[K]>;
} : T;
export type ObjectIdToString<T> = T extends mongodb.ObjectId
? string
: T extends TreatAsPrimitives
? T
: T extends Record<string, any> ? {
[K in keyof T]: T[K] extends mongodb.ObjectId
? string
: T[K] extends Types.DocumentArray<infer ItemType>
? Types.DocumentArray<ObjectIdToString<ItemType>>
: T[K] extends Types.Subdocument<unknown, unknown, infer SubdocType>
? HydratedSingleSubdocument<ObjectIdToString<SubdocType>>
: ObjectIdToString<T[K]>;
} : T;

@@ -765,13 +772,17 @@ /**

*/
export type DateToString<T> = T extends TreatAsPrimitives ? T : T extends Record<string, any> ? {
[K in keyof T]: T[K] extends NativeDate
? string
: T[K] extends (NativeDate | null | undefined)
? string | null | undefined
: T[K] extends Types.DocumentArray<infer ItemType>
? Types.DocumentArray<DateToString<ItemType>>
: T[K] extends Types.Subdocument<unknown, unknown, infer SubdocType>
? HydratedSingleSubdocument<DateToString<SubdocType>>
: DateToString<T[K]>;
} : T;
export type DateToString<T> = T extends NativeDate
? string
: T extends TreatAsPrimitives
? T
: T extends Record<string, any> ? {
[K in keyof T]: T[K] extends NativeDate
? string
: T[K] extends (NativeDate | null | undefined)
? string | null | undefined
: T[K] extends Types.DocumentArray<infer ItemType>
? Types.DocumentArray<DateToString<ItemType>>
: T[K] extends Types.Subdocument<unknown, unknown, infer SubdocType>
? HydratedSingleSubdocument<DateToString<SubdocType>>
: DateToString<T[K]>;
} : T;

@@ -782,11 +793,7 @@ /**

export type SubdocsToPOJOs<T> = T extends TreatAsPrimitives ? T : T extends Record<string, any> ? {
[K in keyof T]: T[K] extends NativeDate
? string
: T[K] extends (NativeDate | null | undefined)
? string | null | undefined
: T[K] extends Types.DocumentArray<infer ItemType>
? ItemType[]
: T[K] extends Types.Subdocument<unknown, unknown, infer SubdocType>
? SubdocType
: SubdocsToPOJOs<T[K]>;
[K in keyof T]: T[K] extends Types.DocumentArray<infer ItemType>
? ItemType[]
: T[K] extends Types.Subdocument<unknown, unknown, infer SubdocType>
? SubdocType
: SubdocsToPOJOs<T[K]>;
} : T;

@@ -793,0 +800,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc