Hello,
I am new to Payload CMS. When I create a collection (for example, post), Payload create a database in mongodb in plural form => (posts). I already have a ready-made database named
post
in singular naming and I need Payload to use that database, so Payload cannot detect that because it is creating (posts) automatically. Can anyone please assist on how I can achieve this?
I did the following, but none of them is successful:
* I tried changing the slug to singular name: It keeps enforcing the name to be in plural form.
* I tried adding
labels: {plural: post}
inside the
CollectionConfig
* I tried adding
graphQL: {pluralName: post}
inside the
CollectionConfig
Database name is auto-generated in plural name
Yep, can reproduce that. Looking into this!
@alessiogr Sure, I would appreciate it if you can advise. Payload totally fits my requirements, but currently I just have this blocker that I couldn't find a solution for neither from the docs nor from the community help.
So there doesn't seem to be a way to disable that currently. Mongoose automatically does the pluralization of slugs.
I've just prepared PR which will allow you to configure this:
https://github.com/payloadcms/payload/pull/2836/filesShould hopefully make it in one of the next payload releases! Or you could install payload from my PR directly if it's fully blocking you and you are willing to risk that it might not be 100% stable and that the API can change
In payload 2.0, we can then hopefully disable the automatic pluralization by default.
@alessiogr Wow! Thank you very much. Glad to know you're implementing this in your next releases.
When I created the CMS app, I used
npx create-payload-app
and then built my requirements on that CMS. If I want to install Payload with your PR changes, may I know how I can achieve that?
check out
https://discord.com/channels/967097582721572934/1115437341356593202/1115630826428846162so make a fork of my pr branch, then build it, commit the build folder and install it
Thank you very much @alessiogr! It is working fine now 🙂
Hello @alessiogr , I have noticed that the branch you made that would fix the pluralization issue for mongodb has been merged (
https://github.com/payloadcms/payload/pull/3153). I am still using the forked branch you provided to me last time, but want to ask, if I update to the latest version in Payload, will
autoPluralization
field be there? Or not yet released?
Hey hey! It won't be in the latest version or any Payload 1.0 version - instead, it will be added in Payload 2.0. Don't worry, the release will be soon 🙂
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.