Socket
Socket
Sign inDemoInstall

mongoose

Package Overview
Dependencies
Maintainers
4
Versions
884
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 7.4.5 to 7.5.0

24

lib/helpers/query/castUpdate.js

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

const mongodbUpdateOperators = new Set([
'$currentDate',
'$inc',
'$min',
'$max',
'$mul',
'$rename',
'$set',
'$setOnInsert',
'$unset',
'$addToSet',
'$pop',
'$pull',
'$push',
'$pullAll',
'$bit'
]);
/**

@@ -62,3 +80,3 @@ * Casts an update op based on the given schema

// if overwrite is set, don't do any of the special $set stuff
if (op[0] !== '$' && !overwrite) {
if (!mongodbUpdateOperators.has(op) && !overwrite) {
// fix up $set sugar

@@ -93,3 +111,3 @@ if (!ret.$set) {

!Buffer.isBuffer(val) &&
(!overwrite || hasDollarKey)) {
(!overwrite || mongodbUpdateOperators.has(op))) {
walkUpdatePath(schema, val, op, options, context, filter);

@@ -546,3 +564,3 @@ } else if (overwrite && ret && typeof ret === 'object') {

if (/^\$/.test($conditional)) {
if (mongodbUpdateOperators.has($conditional)) {
return schema.castForQuery(

@@ -549,0 +567,0 @@ $conditional,

7

lib/schema/array.js

@@ -292,9 +292,2 @@ 'use strict';

const ret = SchemaType.prototype.applyGetters.call(this, value, scope);
if (Array.isArray(ret)) {
const rawValue = utils.isMongooseArray(ret) ? ret.__array : ret;
const len = rawValue.length;
for (let i = 0; i < len; ++i) {
rawValue[i] = this.caster.applyGetters(rawValue[i], scope);
}
}
return ret;

@@ -301,0 +294,0 @@ };

@@ -93,2 +93,5 @@ /*!

}
if (typeof prop === 'string' && numberRE.test(prop) && schematype?.$embeddedSchemaType != null) {
return schematype.$embeddedSchemaType.applyGetters(__array[prop], doc);
}

@@ -95,0 +98,0 @@ return __array[prop];

@@ -643,3 +643,6 @@ 'use strict';

function getValueLookup(obj, part) {
const _from = obj?._doc || obj;
let _from = obj?._doc || obj;
if (_from != null && _from.isMongooseArrayProxy) {
_from = _from.__array;
}
return _from instanceof Map ?

@@ -646,0 +649,0 @@ _from.get(part, mapGetterOptions) :

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

@@ -24,3 +24,3 @@ "keywords": [

"kareem": "2.5.1",
"mongodb": "5.7.0",
"mongodb": "5.8.1",
"mpath": "0.9.0",

@@ -27,0 +27,0 @@ "mquery": "5.0.0",

@@ -218,12 +218,14 @@ import {

IfEquals<PathValueType, Types.Decimal128> extends true ? Types.Decimal128 :
PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer :
IfEquals<PathValueType, Schema.Types.UUID> extends true ? Buffer :
PathValueType extends MapConstructor ? Map<string, ResolvePathType<Options['of']>> :
IfEquals<PathValueType, typeof Schema.Types.Map> extends true ? Map<string, ResolvePathType<Options['of']>> :
PathValueType extends ArrayConstructor ? any[] :
PathValueType extends typeof Schema.Types.Mixed ? any:
IfEquals<PathValueType, ObjectConstructor> extends true ? any:
IfEquals<PathValueType, {}> extends true ? any:
PathValueType extends typeof SchemaType ? PathValueType['prototype'] :
PathValueType extends Record<string, any> ? ObtainDocumentType<PathValueType, any, { typeKey: TypeKey }> :
unknown;
IfEquals<PathValueType, Schema.Types.BigInt> extends true ? bigint :
PathValueType extends 'bigint' | 'BigInt' | typeof Schema.Types.BigInt ? bigint :
PathValueType extends 'uuid' | 'UUID' | typeof Schema.Types.UUID ? Buffer :
IfEquals<PathValueType, Schema.Types.UUID> extends true ? Buffer :
PathValueType extends MapConstructor ? Map<string, ResolvePathType<Options['of']>> :
IfEquals<PathValueType, typeof Schema.Types.Map> extends true ? Map<string, ResolvePathType<Options['of']>> :
PathValueType extends ArrayConstructor ? any[] :
PathValueType extends typeof Schema.Types.Mixed ? any:
IfEquals<PathValueType, ObjectConstructor> extends true ? any:
IfEquals<PathValueType, {}> extends true ? any:
PathValueType extends typeof SchemaType ? PathValueType['prototype'] :
PathValueType extends Record<string, any> ? ObtainDocumentType<PathValueType, any, { typeKey: TypeKey }> :
unknown;

@@ -31,2 +31,3 @@ declare module 'mongoose' {

| PipelineStage.Search
| PipelineStage.SearchMeta
| PipelineStage.Set

@@ -243,2 +244,16 @@ | PipelineStage.SetWindowFields

export interface SearchMeta {
/** [`$searchMeta` reference](https://www.mongodb.com/docs/atlas/atlas-search/query-syntax/#mongodb-pipeline-pipe.-searchMeta) */
$searchMeta: {
index?: string;
highlight?: {
/** [`highlightPath` reference](https://docs.atlas.mongodb.com/atlas-search/path-construction/#multiple-field-search) */
path: string | string[] | { value: string, multi: string };
maxCharsToExamine?: number;
maxNumPassages?: number;
};
[operator: string]: any;
}
}
export interface Set {

@@ -245,0 +260,0 @@ /** [`$set` reference](https://www.mongodb.com/docs/manual/reference/operator/aggregation/set/) */

@@ -314,2 +314,10 @@ declare module 'mongoose' {

class BigInt extends SchemaType {
/** This schema type's name, to defend against minifiers that mangle function names. */
static schemaName: 'BigInt';
/** Default options for this SchemaType */
defaultOptions: Record<string, any>;
}
class Boolean extends SchemaType {

@@ -316,0 +324,0 @@ /** This schema type's name, to defend against minifiers that mangle function names. */

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