-
Notifications
You must be signed in to change notification settings - Fork 23
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
DOCSP-42774: transactions #63
base: standardized
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for docs-mongoid ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a lot of these suggestions with a grain of salt because they definitely stem from my lack of Ruby knowledge.
Also, will the existing Sessions and Transactions pages be removed/redirected?
source/interact-data/transaction.txt
Outdated
In {+odm+}, you can perform transactions by using the following APIs: | ||
|
||
- :ref:`mongoid-txn-high-level`: {+odm+} manages the life cycle of the | ||
transaction. You can use this API in {+odm+} v9.0 and later. | ||
|
||
- :ref:`mongoid-txn-low-level`: You must manage the life cycle of the | ||
transaction. You can use this API in {+odm+} v6.4 and later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S: Feel free to ignore, but something here makes me feel like the APIs are actually named "higher level API" and "lower level API".
In {+odm+}, you can perform transactions by using the following APIs: | |
- :ref:`mongoid-txn-high-level`: {+odm+} manages the life cycle of the | |
transaction. You can use this API in {+odm+} v9.0 and later. | |
- :ref:`mongoid-txn-low-level`: You must manage the life cycle of the | |
transaction. You can use this API in {+odm+} v6.4 and later. | |
In {+odm+}, you can perform transactions by using one or both of the following APIs: | |
- :ref:`Higher Level <mongoid-txn-high-level>`: {+odm+} manages the life cycle of the | |
transaction. You can use this API in {+odm+} v9.0 and later. | |
- :ref:`Lower Level <mongoid-txn-low-level>`: You must manage the life cycle of the | |
transaction. You can use this API in {+odm+} v6.4 and later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll get a clarification on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! left a couple small suggestions.
Also, still curious on how existing Sessions/Transactions pages will fit into this!
:dedent: | ||
|
||
To learn more about the available session options, see the | ||
:ruby-api:`Session class constructor details |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: API links are broken until the next snooty parser release see mongodb/snooty-parser#633
# Starts a session from an instance of Book | ||
book.with_session do |session| | ||
# Starts the transaction in the session | ||
session.start_transaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure whether this and following two examples make sense. We should call session.start_transaction
and session.commit_transaction
or session.abort_transaction
within the same with_session
block. Maybe we should combine there examples into one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed the updated code example over slack: https://mongodb.slack.com/archives/C076TNB2613/p1731947987671689?thread_ts=1731941918.388399&cid=C076TNB2613
source/interact-data/transaction.txt
Outdated
|
||
.. _mongoid-txn-convenient: | ||
|
||
Convenient Transaction API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The term "Convenient Transaction API" refers to the drivers API. It can be used in Mongoid like this (but this it probably not the best idea):
person.with_session do |session|
session.with_transaction do
person.save!
end
end
Maybe we should not using this term to avoid confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted the terminology to use high-level and low-level
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-42774
Staging - https://deploy-preview-63--docs-mongoid.netlify.app/interact-data/transaction/
Self-Review Checklist