What? Fixes issue when on parallel writes in result you can have 0 latest: true versions. Why? There must be always a version with latest: true How? Ensures that we always have a version with latest: true by adding a filter on createdAt < createdVersion.createdAt. Instead, this ponentially can lead to a situation where we have 2 versions with latest: true, if they were created at the exact same time, but this shouldn't happen in a real world scenario and it's much less problematic than not having a version with latest: true. Fixes https://github.com/payloadcms/payload/issues/5895 Changes from #8986 --------- Co-authored-by: Sasha <64744993+r1tsuu@users.noreply.github.com>
Payload MongoDB Adapter
Official MongoDB adapter for Payload.
Installation
npm install @payloadcms/db-mongodb
Usage
import { buildConfig } from 'payload'
import { mongooseAdapter } from '@payloadcms/db-mongodb'
export default buildConfig({
db: mongooseAdapter({
url: process.env.DATABASE_URI,
}),
// ...rest of config
})
More detailed usage can be found in the Payload Docs.