Replies: 4 comments
-
Related PR (not merged yet): #2836 Might also disable this by default in 2.0, though that's not decided yet |
Beta Was this translation helpful? Give feedback.
-
Maybe 2.0 would be a good opportunity to make the current config of: export const People: CollectionConfig = {
slug: "people",
labels: { singular: "Person", plural: "People" },
graphQL: { singularName: "Person", pluralName: "People" },
} more streamlined: export const People: CollectionConfig = {
slug: "people",
singular: "person",
plural: "people",
// Infer these from above
// labels: { singular: "Person", plural: "People" },
// graphQL: { singularName: "Person", pluralName: "People" },
} |
Beta Was this translation helpful? Give feedback.
-
OK so the team and I just talked about this a little bit - and as of now we are hoping to be as declarative as possible here, so that developers have as much flexibility as possible regarding We are also moving toward a database adapter pattern, meaning that any Mongoose-specific properties should be scoped to the future Mongoose adapter itself, and not present in the main Payload config. So that will have some ramifications regarding how we solve this. We will definitely resolve this one way or another very soon. Thank you for bringing this up! |
Beta Was this translation helpful? Give feedback.
-
@jmikrut I am working on a prototype to migrate to Payload with an existing MongoDB. I have been using camel case for my collection names, but it seems like the |
Beta Was this translation helpful? Give feedback.
-
Link to reproduction
https://github.com/rawkode/payload/tree/bug/pluralize
To Reproduce
Create a
CollectionConfig
with a slug ofpeople
.Describe the Bug
Inspect the mongoDB tables and one will be called "peoples"
I tracked this down to
utils.toCollectionName
in mongoose, which in turn callspluralize
, available here.This could be by-passed by providing a variable on
CollectionConfig
to specify the collection name, which would then be passed toSchema()
via schemaOptionsPayload Version
1.9.5
Update from Payload - 31 July 2023
We have determined to add this as a feature request and solve it via a top-level collection property called
databaseEntityName
or similar, which will be enforced on a collection-by-collection basis.Beta Was this translation helpful? Give feedback.
All reactions