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

DOCSP-43072: GridFS #60

Merged
merged 11 commits into from
Oct 11, 2024
Merged

Conversation

norareidy
Copy link
Collaborator

@norareidy norareidy commented Sep 30, 2024

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-43072
Staging - https://deploy-preview-60--docs-c.netlify.app/write/gridfs/

Self-Review Checklist

  • Is this free of any warnings or errors in the RST?
  • Did you run a spell-check?
  • Did you run a grammar-check?
  • Are all the links working?
  • Are the facets and meta keywords accurate?

Copy link

netlify bot commented Sep 30, 2024

Deploy Preview for docs-c ready!

Name Link
🔨 Latest commit cca6997
🔍 Latest deploy log https://app.netlify.com/sites/docs-c/deploys/6709433742a96c0008989971
😎 Deploy Preview https://deploy-preview-60--docs-c.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Collaborator

@mongoKart mongoKart left a comment

Choose a reason for hiding this comment

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

Looks good overall! Some suggestions and questions

source/write/gridfs.txt Outdated Show resolved Hide resolved
Comment on lines 63 to 64
View the following diagram to see how GridFS splits the files when uploaded to
a bucket:
Copy link
Collaborator

Choose a reason for hiding this comment

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

S:

Suggested change
View the following diagram to see how GridFS splits the files when uploaded to
a bucket:
The following diagram shows how GridFS splits files when they are
uploaded to a bucket:

source/write/gridfs.txt Outdated Show resolved Hide resolved
source/write/gridfs.txt Outdated Show resolved Hide resolved
source/write/gridfs.txt Outdated Show resolved Hide resolved
source/write/gridfs.txt Outdated Show resolved Hide resolved
source/write/gridfs.txt Outdated Show resolved Hide resolved
source/write/gridfs.txt Outdated Show resolved Hide resolved
source/write/gridfs.txt Outdated Show resolved Hide resolved
Copy link
Collaborator

@mongoKart mongoKart left a comment

Choose a reason for hiding this comment

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

lgtm! nice work.

Comment on lines 91 to 95
bson_oid_t oid;
bson_oid_init_from_string (&oid, "66fb1b8ea0f84a74ee099e71");
bson_value_t file_id;
file_id.value_type = BSON_TYPE_OID;
memcpy(&file_id.value.v_oid, &oid, sizeof(bson_oid_t));
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note to tech reviewer: this seems like an overly complicated way to pass a file ID, so let me know if there's a better way (same with the next example)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be valid to omit the temporary oid:

Suggested change
bson_oid_t oid;
bson_oid_init_from_string (&oid, "66fb1b8ea0f84a74ee099e71");
bson_value_t file_id;
file_id.value_type = BSON_TYPE_OID;
memcpy(&file_id.value.v_oid, &oid, sizeof(bson_oid_t));
bson_value_t file_id;
file_id.value_type = BSON_TYPE_OID;
bson_oid_init_from_string (&file_id.value.v_oid, "66fb1b8ea0f84a74ee099e71");

(Same suggestion on other occurrences.)

@kevinAlbs kevinAlbs requested review from vector-of-bool and removed request for kevinAlbs October 1, 2024 17:27
@norareidy
Copy link
Collaborator Author

Hi @vector-of-bool, just bumping this last PR review for the C standardization epic!

Copy link
Collaborator

@vector-of-bool vector-of-bool left a comment

Choose a reason for hiding this comment

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

LGTM, with minor comments on example code.

Comment on lines 91 to 95
bson_oid_t oid;
bson_oid_init_from_string (&oid, "66fb1b8ea0f84a74ee099e71");
bson_value_t file_id;
file_id.value_type = BSON_TYPE_OID;
memcpy(&file_id.value.v_oid, &oid, sizeof(bson_oid_t));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be valid to omit the temporary oid:

Suggested change
bson_oid_t oid;
bson_oid_init_from_string (&oid, "66fb1b8ea0f84a74ee099e71");
bson_value_t file_id;
file_id.value_type = BSON_TYPE_OID;
memcpy(&file_id.value.v_oid, &oid, sizeof(bson_oid_t));
bson_value_t file_id;
file_id.value_type = BSON_TYPE_OID;
bson_oid_init_from_string (&file_id.value.v_oid, "66fb1b8ea0f84a74ee099e71");

(Same suggestion on other occurrences.)

Comment on lines 29 to 30
bson_t opts;
bson_init(&opts);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefer BSON_INITIALIZER

Suggested change
bson_t opts;
bson_init(&opts);
bson_t opts = BSON_INITIALIZER;

Comment on lines 45 to 49
if (upload_stream == NULL) {
fprintf (stderr, "Failed to create upload stream: %s\n", error.message);
}
const char *data = "Data to store";
mongoc_stream_write (upload_stream, data, strlen(data), -1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: Should not try to use the stream on failure.

Suggested change
if (upload_stream == NULL) {
fprintf (stderr, "Failed to create upload stream: %s\n", error.message);
}
const char *data = "Data to store";
mongoc_stream_write (upload_stream, data, strlen(data), -1);
if (upload_stream == NULL) {
fprintf (stderr, "Failed to create upload stream: %s\n", error.message);
} else {
const char *data = "Data to store";
mongoc_stream_write (upload_stream, data, strlen(data), -1);
}

Or show the example aborting/goto fail/etc.

@norareidy norareidy merged commit 48d3f75 into mongodb:standardization Oct 11, 2024
4 of 5 checks passed
@norareidy norareidy deleted the DOCSP-43072-gridfs branch October 11, 2024 15:32
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.

3 participants