@payloadcms/db-mongodb
Advanced tools
Comparing version 3.0.0-alpha.54 to 3.0.0-alpha.55
/* eslint-disable no-param-reassign */ import mongoose from 'mongoose'; | ||
import paginate from 'mongoose-paginate-v2'; | ||
import { buildVersionCollectionFields, buildVersionGlobalFields, getVersionsModelName } from 'payload/versions'; | ||
import { buildVersionCollectionFields, buildVersionGlobalFields } from 'payload/versions'; | ||
import buildCollectionSchema from './models/buildCollectionSchema.js'; | ||
@@ -8,2 +8,3 @@ import { buildGlobalModel } from './models/buildGlobalModel.js'; | ||
import getBuildQueryPlugin from './queries/buildQuery.js'; | ||
import { getDBName } from './utilities/getDBName.js'; | ||
export const init = function init() { | ||
@@ -13,3 +14,6 @@ this.payload.config.collections.forEach((collection)=>{ | ||
if (collection.versions) { | ||
const versionModelName = getVersionsModelName(collection); | ||
const versionModelName = getDBName({ | ||
config: collection, | ||
versions: true | ||
}); | ||
const versionCollectionFields = buildVersionCollectionFields(collection); | ||
@@ -34,3 +38,5 @@ const versionSchema = buildSchema(this.payload.config, versionCollectionFields, { | ||
} | ||
const model = mongoose.model(collection.slug, schema, this.autoPluralization === true ? undefined : collection.slug); | ||
const model = mongoose.model(getDBName({ | ||
config: collection | ||
}), schema, this.autoPluralization === true ? undefined : collection.slug); | ||
this.collections[collection.slug] = model; | ||
@@ -47,3 +53,6 @@ // TS expect error only needed until we launch 2.0.0 | ||
if (global.versions) { | ||
const versionModelName = getVersionsModelName(global); | ||
const versionModelName = getDBName({ | ||
config: global, | ||
versions: true | ||
}); | ||
const versionGlobalFields = buildVersionGlobalFields(global); | ||
@@ -50,0 +59,0 @@ const versionSchema = buildSchema(this.payload.config, versionGlobalFields, { |
@@ -231,3 +231,3 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ /* eslint-disable class-methods-use-this */ /* eslint-disable @typescript-eslint/no-use-before-define */ import mongoose from 'mongoose'; | ||
schema.index({ | ||
[`${field.name}.${locale}`]: '2dsphere' | ||
[`${field.name}.${locale.code}`]: '2dsphere' | ||
}, indexOptions); | ||
@@ -234,0 +234,0 @@ }); |
{ | ||
"name": "@payloadcms/db-mongodb", | ||
"version": "3.0.0-alpha.54", | ||
"version": "3.0.0-alpha.55", | ||
"description": "The officially supported MongoDB database adapter for Payload", | ||
@@ -26,3 +26,2 @@ "repository": { | ||
"mongoose": "6.12.3", | ||
"mongoose-aggregate-paginate-v2": "1.0.6", | ||
"mongoose-paginate-v2": "1.7.22", | ||
@@ -36,7 +35,7 @@ "prompts": "2.4.2", | ||
"mongodb-memory-server": "^9", | ||
"payload": "3.0.0-alpha.54", | ||
"@payloadcms/eslint-config": "1.1.1" | ||
"@payloadcms/eslint-config": "1.1.1", | ||
"payload": "3.0.0-alpha.55" | ||
}, | ||
"peerDependencies": { | ||
"payload": "3.0.0-alpha.54" | ||
"payload": "3.0.0-alpha.55" | ||
}, | ||
@@ -43,0 +42,0 @@ "exports": { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
311938
9
180
3197
+ Added@payloadcms/translations@3.0.0-alpha.55(transitive)
+ Addedpayload@3.0.0-alpha.55(transitive)
- Removedmongoose-aggregate-paginate-v2@1.0.6
- Removed@payloadcms/translations@3.0.0-alpha.54(transitive)
- Removedmongoose-aggregate-paginate-v2@1.0.6(transitive)
- Removedpayload@3.0.0-alpha.54(transitive)