Skip to content

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

Merged
DanRibbens merged 19 commits into
betafrom
feat/update-mongoose-v8
Nov 15, 2024
Merged

feat(db-mongodb)!: update mongoose to 8.8.1#9115
DanRibbens merged 19 commits into
betafrom
feat/update-mongoose-v8

Conversation

@DanRibbens

@DanRibbens DanRibbens commented Nov 11, 2024

Copy link
Copy Markdown
Contributor

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

r1tsuu commented Nov 12, 2024

Copy link
Copy Markdown
Member
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
@DanRibbens DanRibbens deleted the feat/update-mongoose-v8 branch November 15, 2024 17:03
@github-actions

Copy link
Copy Markdown
Contributor

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

kendelljoseph pushed a commit that referenced this pull request Feb 21, 2025
### 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](https://mongoosejs.com/docs/7.x/docs/migrating_to_7.html) and [v7 to
v8](https://mongoosejs.com/docs/migrating_to_8.html) and make
adjustments as needed.

---------

Co-authored-by: Sasha <64744993+r1tsuu@users.noreply.github.com>
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