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

mongoose

Package Overview
Dependencies
Maintainers
4
Versions
890
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.7.2 to 8.7.3

31

lib/cursor/aggregationCursor.js

@@ -200,2 +200,33 @@ /*!

/**
* Marks this cursor as destroyed. Will stop streaming and subsequent calls to
* `next()` will error.
*
* @return {this}
* @api private
* @method _destroy
*/
AggregationCursor.prototype._destroy = function _destroy(_err, callback) {
let waitForCursor = null;
if (!this.cursor) {
waitForCursor = new Promise((resolve) => {
this.once('cursor', resolve);
});
} else {
waitForCursor = Promise.resolve();
}
waitForCursor
.then(() => this.cursor.close())
.then(() => {
this._closed = true;
callback();
})
.catch(error => {
callback(error);
});
return this;
};
/**
* Get the next document from this cursor. Will return `null` when there are

@@ -202,0 +233,0 @@ * no documents left.

@@ -242,2 +242,35 @@ /*!

/**
* Marks this cursor as destroyed. Will stop streaming and subsequent calls to
* `next()` will error.
*
* @return {this}
* @api private
* @method _destroy
*/
QueryCursor.prototype._destroy = function _destroy(_err, callback) {
let waitForCursor = null;
if (!this.cursor) {
waitForCursor = new Promise((resolve) => {
this.once('cursor', resolve);
});
} else {
waitForCursor = Promise.resolve();
}
waitForCursor
.then(() => {
this.cursor.close();
})
.then(() => {
this._closed = true;
callback();
})
.catch(error => {
callback(error);
});
return this;
};
/**
* Rewind this cursor to its uninitialized state. Any options that are present on the cursor will

@@ -244,0 +277,0 @@ * remain in effect. Iterating this cursor will cause new queries to be sent to the server, even

2

package.json
{
"name": "mongoose",
"description": "Mongoose MongoDB ODM",
"version": "8.7.2",
"version": "8.7.3",
"author": "Guillermo Rauch <guillermo@learnboost.com>",

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

@@ -53,2 +53,8 @@ declare module 'mongoose' {

autoCreate?: boolean;
/**
* Sanitizes query filters against [query selector injection attacks](
* https://thecodebarbarian.com/2014/09/04/defending-against-query-selector-injection-attacks.html
* ) by wrapping any nested objects that have a property whose name starts with $ in a $eq.
*/
sanitizeFilter?: boolean;
}

@@ -55,0 +61,0 @@

@@ -30,2 +30,8 @@ declare module 'mongoose' {

/**
* Destroy this cursor, closing the underlying cursor. Will stop streaming
* and subsequent calls to `next()` will error.
*/
destroy(): this;
/**
* Rewind this cursor to its uninitialized state. Any options that are present on the cursor will

@@ -32,0 +38,0 @@ * remain in effect. Iterating this cursor will cause new queries to be sent to the server, even

@@ -709,2 +709,5 @@ /// <reference path="./aggregate.d.ts" />

/**
* Converts any Buffer properties into mongodb.Binary instances, which is what `lean()` returns
*/
export type BufferToBinary<T> = T extends TreatAsPrimitives ? T : T extends Record<string, any> ? {

@@ -723,2 +726,72 @@ [K in keyof T]: T[K] extends Buffer

/**
* Converts any Buffer properties into { type: 'buffer', data: [1, 2, 3] } format for JSON serialization
*/
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;
/**
* Converts any ObjectId properties into strings for JSON serialization
*/
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;
/**
* Converts any Date properties into strings for JSON serialization
*/
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;
/**
* Converts any Mongoose subdocuments (single nested or doc arrays) into POJO equivalents
*/
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]>;
} : T;
export type JSONSerialized<T> = SubdocsToPOJOs<
FlattenMaps<
BufferToJSON<
ObjectIdToString<
DateToString<T>
>
>
>
>;
/**
* Separate type is needed for properties of union type (for example, Types.DocumentArray | undefined) to apply conditional check to each member of it

@@ -725,0 +798,0 @@ * https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types

@@ -149,5 +149,6 @@ import {

*/
type RequiredPaths<T, TypeKey extends string = DefaultTypeKey> = {
[K in RequiredPathKeys<T, TypeKey>]: T[K];
};
type RequiredPaths<T, TypeKey extends string = DefaultTypeKey> = Pick<
{ -readonly [K in keyof T]: T[K] },
RequiredPathKeys<T, TypeKey>
>;

@@ -170,5 +171,6 @@ /**

*/
type OptionalPaths<T, TypeKey extends string = DefaultTypeKey> = {
[K in OptionalPathKeys<T, TypeKey>]?: T[K];
};
type OptionalPaths<T, TypeKey extends string = DefaultTypeKey> = Pick<
{ -readonly [K in keyof T]?: T[K] },
OptionalPathKeys<T, TypeKey>
>;

@@ -175,0 +177,0 @@ /**

@@ -67,8 +67,5 @@ declare module 'mongoose' {

type InsertManyResult<T> = mongodb.InsertManyResult<T> & {
insertedIds: {
[key: number]: InferId<T>;
};
interface InsertManyResult<T> extends mongodb.InsertManyResult<T> {
mongoose?: { validationErrors?: Array<Error.CastError | Error.ValidatorError> };
};
}

@@ -75,0 +72,0 @@ type UpdateWriteOpResult = mongodb.UpdateResult;

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