Socket
Socket
Sign inDemoInstall

@payloadcms/db-mongodb

Package Overview
Dependencies
Maintainers
7
Versions
299
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@payloadcms/db-mongodb - npm Package Compare versions

Comparing version 3.0.0-beta.97 to 3.0.0-beta.98

4

dist/connect.js

@@ -18,3 +18,5 @@ import mongoose from 'mongoose';

};
if (hotReload) connectionOptions.autoIndex = false;
if (hotReload) {
connectionOptions.autoIndex = false;
}
try {

@@ -21,0 +23,0 @@ this.connection = (await mongoose.connect(urlToConnect, connectionOptions)).connection;

import type { CollationOptions, TransactionOptions } from 'mongodb';
import type { MongoMemoryReplSet } from 'mongodb-memory-server';
import type { ClientSession, ConnectOptions, Connection } from 'mongoose';
import type { ClientSession, Connection, ConnectOptions } from 'mongoose';
import type { BaseDatabaseAdapter, DatabaseAdapterObj } from 'payload';

@@ -51,3 +51,3 @@ import type { CollectionModel, GlobalModel, MigrateDownArgs, MigrateUpArgs } from './types.js';

}[];
transactionOptions?: TransactionOptions | false;
transactionOptions?: false | TransactionOptions;
/** The URL to connect to MongoDB or false to start payload and prevent connecting */

@@ -54,0 +54,0 @@ url: false | string;

@@ -40,4 +40,4 @@ import fs from 'fs';

collections: {},
connection: undefined,
connectOptions: connectOptions || {},
connection: undefined,
count,

@@ -108,3 +108,5 @@ disableIndexHints,

// Use arg if provided
if (migrationDir) return migrationDir;
if (migrationDir) {
return migrationDir;
}
// Check other common locations

@@ -111,0 +113,0 @@ if (fs.existsSync(srcDir)) {

@@ -247,3 +247,5 @@ import mongoose from 'mongoose';

enum: field.options.map((option)=>{
if (typeof option === 'object') return option.value;
if (typeof option === 'object') {
return option.value;
}
return option;

@@ -359,3 +361,5 @@ })

enum: field.options.map((option)=>{
if (typeof option === 'object') return option.value;
if (typeof option === 'object') {
return option.value;
}
return option;

@@ -362,0 +366,0 @@ })

@@ -17,3 +17,5 @@ import ObjectIdImport from 'bson-objectid';

let sanitizedPath = incomingPath.replace(/__/g, '.');
if (sanitizedPath === 'id') sanitizedPath = '_id';
if (sanitizedPath === 'id') {
sanitizedPath = '_id';
}
let paths = [];

@@ -56,5 +58,7 @@ let hasCustomID = false;

});
if (rawQuery) return {
value: rawQuery
};
if (rawQuery) {
return {
value: rawQuery
};
}
// If there are multiple collections to search through,

@@ -138,3 +142,5 @@ // Recursively build up a list of query constraints

let multiIDCondition = '$or';
if (operatorKey === '$ne') multiIDCondition = '$and';
if (operatorKey === '$ne') {
multiIDCondition = '$and';
}
const result = {

@@ -167,7 +173,9 @@ value: {

});
if (hasNumberIDRelation) result.value[multiIDCondition].push({
[path]: {
[operatorKey]: parseFloat(formattedValue)
}
});
if (hasNumberIDRelation) {
result.value[multiIDCondition].push({
[path]: {
[operatorKey]: parseFloat(formattedValue)
}
});
}
}

@@ -174,0 +182,0 @@ }

@@ -26,3 +26,5 @@ import { deepMergeWithCombinedArrays } from 'payload';

});
if (builtConditions.length > 0) result[conditionOperator] = builtConditions;
if (builtConditions.length > 0) {
result[conditionOperator] = builtConditions;
}
} else {

@@ -29,0 +31,0 @@ // It's a path - and there can be multiple comparisons on a single path.

@@ -29,4 +29,8 @@ import mongoose from 'mongoose';

if (field.type === 'checkbox' && typeof val === 'string') {
if (val.toLowerCase() === 'true') formattedValue = true;
if (val.toLowerCase() === 'false') formattedValue = false;
if (val.toLowerCase() === 'true') {
formattedValue = true;
}
if (val.toLowerCase() === 'false') {
formattedValue = false;
}
}

@@ -83,5 +87,9 @@ if ([

];
if (mongoose.Types.ObjectId.isValid(inVal)) newValues.push(new mongoose.Types.ObjectId(inVal));
if (mongoose.Types.ObjectId.isValid(inVal)) {
newValues.push(new mongoose.Types.ObjectId(inVal));
}
const parsedNumber = parseFloat(inVal);
if (!Number.isNaN(parsedNumber)) newValues.push(parsedNumber);
if (!Number.isNaN(parsedNumber)) {
newValues.push(parsedNumber);
}
return [

@@ -118,4 +126,8 @@ ...formattedValues,

};
if (maxDistance) formattedValue.$maxDistance = parseFloat(maxDistance);
if (minDistance) formattedValue.$minDistance = parseFloat(minDistance);
if (maxDistance) {
formattedValue.$maxDistance = parseFloat(maxDistance);
}
if (minDistance) {
formattedValue.$minDistance = parseFloat(minDistance);
}
}

@@ -122,0 +134,0 @@ }

export const commitTransaction = async function commitTransaction(id) {
if (id instanceof Promise) return;
if (id instanceof Promise) {
return;
}
if (!this.sessions[id]?.inTransaction()) {

@@ -4,0 +6,0 @@ return;

import type { IndexDefinition, IndexOptions, Model, PaginateModel, SchemaOptions } from 'mongoose';
import type { ArrayField, BlockField, CheckboxField, CodeField, CollapsibleField, DateField, EmailField, Field, GroupField, JSONField, NumberField, Payload, PointField, RadioField, RelationshipField, RichTextField, RowField, SanitizedConfig, SelectField, TabsField, TextField, TextareaField, UploadField } from 'payload';
import type { ArrayField, BlockField, CheckboxField, CodeField, CollapsibleField, DateField, EmailField, Field, GroupField, JSONField, NumberField, Payload, PointField, RadioField, RelationshipField, RichTextField, RowField, SanitizedConfig, SelectField, TabsField, TextareaField, TextField, UploadField } from 'payload';
import type { BuildQueryArgs } from './queries/buildQuery.js';

@@ -4,0 +4,0 @@ export interface CollectionModel extends Model<any>, PaginateModel<any> {

@@ -15,3 +15,5 @@ /**

}
if (versions) result = `_${result}_versions`;
if (versions) {
result = `_${result}_versions`;
}
return result;

@@ -18,0 +20,0 @@ };

@@ -9,7 +9,9 @@ /**

}
if (req) return db.sessions[transactionID] ? {
session: db.sessions[transactionID]
} : {};
if (req) {
return db.sessions[transactionID] ? {
session: db.sessions[transactionID]
} : {};
}
}
//# sourceMappingURL=withSession.js.map
{
"name": "@payloadcms/db-mongodb",
"version": "3.0.0-beta.97",
"version": "3.0.0-beta.98",
"description": "The officially supported MongoDB database adapter for Payload",

@@ -40,7 +40,7 @@ "homepage": "https://payloadcms.com",

"mongodb-memory-server": "^9",
"@payloadcms/eslint-config": "3.0.0-beta.59",
"payload": "3.0.0-beta.97"
"@payloadcms/eslint-config": "3.0.0-beta.97",
"payload": "3.0.0-beta.98"
},
"peerDependencies": {
"payload": "3.0.0-beta.97"
"payload": "3.0.0-beta.98"
},

@@ -47,0 +47,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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