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): add support for query options in update operations #9191

Conversation

franciscolourenco
Copy link
Contributor

The mongodb adapter updateOne method accepts an options argument that allows query options to be passed to mongoose. This parameter was added in #8397 to support the upsert operation.

This options parameter can also be useful when using the database adaptor directly without going through the local api. It is true that the Mongoose models could be used directly in such situations, but the adapter methods include a lot of useful functionality, like for instance the sanitization of document and relationship ids, so it is desirable to be able to use the adapter functions while still being able to provide mongoose query options (e.g. {timestamps: false}).

This PR adds the same options parameter to the other update methods of the mongodb adapter.

@franciscolourenco franciscolourenco changed the title feat(db-mongodb): add support for query options to update operations feat(db-mongodb): add support for query options in update operations Nov 13, 2024
Copy link
Contributor

@DanRibbens DanRibbens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

@DanRibbens DanRibbens merged commit 2d2d020 into payloadcms:beta Nov 14, 2024
56 of 58 checks passed
jacobsfletch pushed a commit that referenced this pull request Nov 14, 2024
The mongodb adapter `updateOne` method accepts an `options` argument
that allows query options to be passed to mongoose. This parameter was
added in #8397 to support the
`upsert` operation.

This `options` parameter can also be useful when using the database
adaptor directly without going through the local api. It is true that
the Mongoose models could be used directly in such situations, but the
adapter methods include a lot of useful functionality, like for instance
the sanitization of document and relationship ids, so it is desirable to
be able to use the adapter functions while still being able to provide
mongoose query options (e.g. `{timestamps: false}`).

This PR adds the same options parameter to the other update methods of
the mongodb adapter.
Copy link

🚀 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants