You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

mongoose

Package Overview
Dependencies
Maintainers
4
Versions
938
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

to
8.16.2

15

lib/cursor/queryCursor.js

@@ -509,10 +509,11 @@ /*!

ctx.query.model.populate(doc, ctx._pop).then(
doc => {
_nextDoc(ctx, doc, ctx._pop, callback);
},
err => {
callback(err);
_nextDoc(ctx, doc, ctx._pop, (err, doc) => {
if (err != null) {
return callback(err);
}
);
ctx.query.model.populate(doc, ctx._pop).then(
doc => callback(null, doc),
err => callback(err)
);
});
},

@@ -519,0 +520,0 @@ error => {

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

/**
* If truthy, Mongoose will add a custom setter that lowercases this string
* If truthy, Mongoose will add a [custom setter](https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.set()) that lowercases this string
* using JavaScript's built-in `String#toLowerCase()`.

@@ -62,3 +62,3 @@ *

/**
* If truthy, Mongoose will add a custom setter that removes leading and trailing
* If truthy, Mongoose will add a [custom setter](https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.set()) that removes leading and trailing
* whitespace using [JavaScript's built-in `String#trim()`](https://masteringjs.io/tutorials/fundamentals/trim-string).

@@ -65,0 +65,0 @@ *

@@ -127,2 +127,15 @@ /*!

/**
* Returns this schema type's representation in a JSON schema.
*
* @param [options]
* @param [options.useBsonType=false] If true, return a representation with `bsonType` for use with MongoDB's `$jsonSchema`.
* @returns {Object} JSON schema properties
*/
// eslint-disable-next-line no-unused-vars
SchemaMixed.prototype.toJSONSchema = function toJSONSchema(_options) {
return {};
};
/*!

@@ -129,0 +142,0 @@ * Module exports.

@@ -698,6 +698,9 @@ 'use strict';

*
* // Setters also transform query filters
* const user = await User.find({ email: 'AVENUE@Q.COM' }); // query for 'avenue@q.com'
*
* As you can see above, setters allow you to transform the data before it
* stored in MongoDB, or before executing a query.
*
* _NOTE: we could have also just used the built-in `lowercase: true` SchemaType option instead of defining our own function._
* _NOTE: we could have also just used the built-in [`lowercase: true` SchemaType option](https://mongoosejs.com/docs/api/schemastringoptions.html#SchemaStringOptions.prototype.lowercase) instead of defining our own function._
*

@@ -1783,4 +1786,4 @@ * new Schema({ email: { type: String, lowercase: true }})

SchemaType.prototype.toJSONSchema = function toJSONSchema() {
throw new Error('Converting unsupported SchemaType to JSON Schema: ' + this.instance);
SchemaType.prototype.toJSONSchema = function toJSONSchema(_options) { // eslint-disable-line no-unused-vars
throw new Error(`Converting unsupported SchemaType to JSON Schema: ${this.instance} at path "${this.path}"`);
};

@@ -1787,0 +1790,0 @@

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

@@ -32,5 +32,5 @@ "keywords": [

"devDependencies": {
"@babel/core": "7.27.4",
"@babel/core": "7.27.7",
"@babel/preset-env": "7.27.2",
"@mongodb-js/mongodb-downloader": "^0.3.9",
"@mongodb-js/mongodb-downloader": "^0.4.2",
"@typescript-eslint/eslint-plugin": "^8.19.1",

@@ -46,3 +46,3 @@ "@typescript-eslint/parser": "^8.19.1",

"buffer": "^5.6.0",
"cheerio": "1.0.0",
"cheerio": "1.1.0",
"crypto-browserify": "3.12.1",

@@ -61,3 +61,3 @@ "dox": "1.0.0",

"mkdirp": "^3.0.1",
"mocha": "11.5.0",
"mocha": "11.7.1",
"moment": "2.30.1",

@@ -70,3 +70,3 @@ "mongodb-memory-server": "10.1.4",

"q": "1.5.1",
"sinon": "20.0.0",
"sinon": "21.0.0",
"stream-browserify": "3.0.0",

@@ -73,0 +73,0 @@ "tsd": "0.32.0",

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

export interface ToObjectOptions<THydratedDocumentType = HydratedDocument<unknown>> {
export interface ToObjectOptions<RawDocType = unknown, THydratedDocumentType = HydratedDocument<RawDocType>> {
/** if `options.virtuals = true`, you can set `options.aliases = false` to skip applying aliases. This option is a no-op if `options.virtuals = false`. */

@@ -228,3 +228,3 @@ aliases?: boolean;

doc: THydratedDocumentType,
ret: Record<string, any>,
ret: Default__v<Require_id<RawDocType>>,
options: ToObjectOptions<THydratedDocumentType>

@@ -510,3 +510,3 @@ ) => any);

/** Sets a schema option. */
set<K extends keyof SchemaOptions>(key: K, value: SchemaOptions[K], _tags?: any): this;
set<K extends keyof SchemaOptions>(key: K, value: SchemaOptions<DocType>[K], _tags?: any): this;

@@ -525,3 +525,3 @@ /** Adds static "class" methods to Models compiled from this schema. */

/** Creates a virtual type with the given name. */
virtual<T = HydratedDocument<DocType, TVirtuals & TInstanceMethods, TQueryHelpers>>(
virtual<T = THydratedDocumentType>(
name: keyof TVirtuals | string,

@@ -528,0 +528,0 @@ options?: VirtualTypeOptions<T, DocType>

@@ -149,3 +149,3 @@ declare module 'mongoose' {

/** Exactly the same as the toObject option but only applies when the document's toJSON method is called. */
toJSON?: ToObjectOptions<THydratedDocumentType>;
toJSON?: ToObjectOptions<DocType, THydratedDocumentType>;
/**

@@ -157,3 +157,3 @@ * Documents have a toObject method which converts the mongoose document into a plain JavaScript object.

*/
toObject?: ToObjectOptions<THydratedDocumentType>;
toObject?: ToObjectOptions<DocType, THydratedDocumentType>;
/**

@@ -160,0 +160,0 @@ * By default, if you have an object with key 'type' in your schema, mongoose will interpret it as a

@@ -199,9 +199,9 @@ import * as BSON from 'bson';

/** If truthy, Mongoose will add a custom setter that lowercases this string using JavaScript's built-in `String#toLowerCase()`. */
/** If truthy, Mongoose will add a [custom setter](https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.set()) that lowercases this string using JavaScript's built-in `String#toLowerCase()`. */
lowercase?: boolean;
/** If truthy, Mongoose will add a custom setter that removes leading and trailing whitespace using JavaScript's built-in `String#trim()`. */
/** If truthy, Mongoose will add a [custom setter](https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.set()) that removes leading and trailing whitespace using JavaScript's built-in `String#trim()`. */
trim?: boolean;
/** If truthy, Mongoose will add a custom setter that uppercases this string using JavaScript's built-in `String#toUpperCase()`. */
/** If truthy, Mongoose will add a [custom setter](https://mongoosejs.com/docs/api/schematype.html#SchemaType.prototype.set()) that uppercases this string using JavaScript's built-in `String#toUpperCase()`. */
uppercase?: boolean;

@@ -208,0 +208,0 @@

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

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