Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(db-mongodb)!: update mongoose to 8.8.1 #9115

Merged
merged 19 commits into from
Nov 15, 2024
Merged

Conversation

DanRibbens
Copy link
Contributor

@DanRibbens DanRibbens commented Nov 11, 2024

What?

Upgrades mongoose from 6 to latest v8.8.1

Fixes #9171

Why?

Compatibilty with Mongodb Atlas

How?

  • Updates deps
  • Changed ObjectId from bson-objectid to use new Type.ObjectId from mongoose for compatibility (only inside of db-mongodb)
  • Internal type adjustments

#9088

BREAKING CHANGES:
All projects with existing data having versions enabled, or relationship or upload fields will want to create the predefined migration that converts all strings to ObjectIDs where needed.
This can be created using payload migrate:create --file @payloadcms/mongodb/relationships-v2-v3.

For projects making use of the exposed Models from mongoose, review the upgrade guides from v6 to v7 and [v7 to v8 (https://mongoosejs.com/docs/migrating_to_8.html) and make adjustments as needed.

@DanRibbens DanRibbens changed the title feat: update mongoose to 8.8.1 feat!(db-mongodb): update mongoose to 8.8.1 Nov 11, 2024
@DanRibbens DanRibbens changed the title feat!(db-mongodb): update mongoose to 8.8.1 feat(db-mongodb)!: update mongoose to 8.8.1 Nov 11, 2024
@r1tsuu
Copy link
Member

r1tsuu commented Nov 12, 2024

MongoServerError: $geoNear, $near, and $nearSphere are not allowed in this context

From https://www.npmjs.com/package/mongoose-paginate-v2
image

removing forceCountFn fixes that

@r1tsuu r1tsuu force-pushed the feat/update-mongoose-v8 branch from 596cfcd to 7d94618 Compare November 12, 2024 12:16
@payloadcms payloadcms deleted a comment from socket-security bot Nov 12, 2024
@DanRibbens DanRibbens added this to the 3.0 Release milestone Nov 13, 2024
- Adds predefined migration `@payloadcms/db-mongodb/relationships-v2-v3`
that converts all string relationship values to ObjectIDs.
- Fixes / refactors `versions-v1-v2` migration, ensures the transaction is
used
- Adds tests for Mongoose predefined migrations
@r1tsuu r1tsuu force-pushed the feat/update-mongoose-v8 branch from 156e2fc to 8da019e Compare November 14, 2024 22:27
@r1tsuu r1tsuu force-pushed the feat/update-mongoose-v8 branch 2 times, most recently from 214f961 to b553a25 Compare November 15, 2024 00:33
@r1tsuu r1tsuu force-pushed the feat/update-mongoose-v8 branch from b553a25 to 01fea15 Compare November 15, 2024 00:37
@DanRibbens DanRibbens marked this pull request as ready for review November 15, 2024 16:28
@DanRibbens DanRibbens merged commit 7c6f419 into beta Nov 15, 2024
53 checks passed
@DanRibbens DanRibbens deleted the feat/update-mongoose-v8 branch November 15, 2024 17:03
Copy link
Contributor

🚀 This is included in version v3.0.0-beta.131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot query relationship in blocks
2 participants