-
Notifications
You must be signed in to change notification settings - Fork 11
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-43095: Transactions #59
DOCSP-43095: Transactions #59
Conversation
✅ Deploy Preview for docs-c 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.
Few things I noticed upon inspection:
- I got some relevant technical feedback on the transactions pg for PHP driver. I think using that page as a template for this page would use the most up to date and technically correct info about transactions.
- It would be best to show an example that uses the Convenient transactions API instead of the manual (core) API, unless requested by the C dbx team. This API uses the
mongoc_client_session_with_transaction()
method. - The transactions example is most useful if it shows a common use case such as committing changes across multiple collections. It is a slight improvement to the example that would more closely match the use case for many users. see PHP page for an example you might want to adapt.
Let me know if you have any questions about this feedback! I'll wait to leave a more detailed review in the next round.
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! thanks for implementing that feedback quickly.
source/includes/write/transactions.c
Outdated
mongoc_collection_t *savings = mongoc_client_get_collection (client, "sample_bank", "savings"); | ||
mongoc_collection_t *receipts = mongoc_client_get_collection (client, "sample_bank", "receipts"); | ||
|
||
char *account_id = "123456"; |
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.
char *account_id = "123456"; | |
const char *account_id = "123456"; |
Not recommended to define non-const string literals.
source/includes/write/transactions.c
Outdated
// end-callback | ||
|
||
int | ||
main (int argc, char *argv[]) |
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.
main (int argc, char *argv[]) | |
main (void) |
Prevent unused variable warnings by skipping argc and argv in main if they are unused.
source/includes/write/transactions.c
Outdated
|
||
// start-callback | ||
bool | ||
transaction_callback (mongoc_client_session_t *session) |
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.
transaction_callback (mongoc_client_session_t *session) | |
transaction_callback(mongoc_client_session_t *session, void *ctx, | |
bson_t **reply, bson_error_t *error) | |
{ | |
BSON_UNUSED(ctx); | |
BSON_UNUSED(reply); |
Declaring the full callback type prevents a function casting warning and I think it's more informative.
Pull Request Info
PR Reviewing Guidelines
JIRA - https://jira.mongodb.org/browse/DOCSP-43095
Staging - https://deploy-preview-59--docs-c.netlify.app/write/transactions/
Self-Review Checklist