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-43063 Time Series Data #55

Conversation

jordan-smith721
Copy link
Collaborator

@jordan-smith721 jordan-smith721 commented Sep 27, 2024

Pull Request Info

PR Reviewing Guidelines

JIRA - https://jira.mongodb.org/browse/DOCSP-43063
Staging - https://deploy-preview-55--docs-c.netlify.app/databases-collections/time-series/

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 27, 2024

Deploy Preview for docs-c ready!

Name Link
🔨 Latest commit 5a4d132
🔍 Latest deploy log https://app.netlify.com/sites/docs-c/deploys/66fffcb759d0c2000821f365
😎 Deploy Preview https://deploy-preview-55--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.

@jordan-smith721 jordan-smith721 marked this pull request as ready for review September 27, 2024 20:08
Copy link
Collaborator

@mcmorisi mcmorisi left a comment

Choose a reason for hiding this comment

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

Some nits and one open question! Looks good otherwise, but would appreciate @kevinAlbs feedback on one point.


- The database in which to create the collection
- The name of the new collection to create
- A ``timeseries`` object that specifies the ``timeField`` option
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure if "object" is the correct terminology here.

@kevinAlbs might be able to clarify.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That particular parameter is a bson_t, so I would suggest altering as such:

Suggested change
- A ``timeseries`` object that specifies the ``timeField`` option
- A BSON document that specifies the ``timeField`` option

source/databases-collections/time-series.txt Outdated Show resolved Hide resolved
source/databases-collections/time-series.txt Outdated Show resolved Hide resolved
source/databases-collections/time-series.txt Outdated Show resolved Hide resolved
source/databases-collections/time-series.txt Outdated Show resolved Hide resolved
Copy link
Collaborator

@mcmorisi mcmorisi left a comment

Choose a reason for hiding this comment

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

LGTM!

@kevinAlbs kevinAlbs requested review from joshbsiegel and removed request for kevinAlbs October 1, 2024 17:23
@stephmarie17 stephmarie17 mentioned this pull request Oct 1, 2024
5 tasks
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
int main (int argc, char *argv[])
int main (void)

Suggest passing through no arguments as to avoid warnings (arguments aren't used in the program).

"location", "{", "city", BCON_UTF8 ("New York"), "}",
"timestamp", BCON_DATE_TIME (1633046400000));

mongoc_collection_insert_one (collection, insert_doc, NULL, NULL, &error))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
mongoc_collection_insert_one (collection, insert_doc, NULL, NULL, &error))
mongoc_collection_insert_one (collection, insert_doc, NULL, NULL, &error);

"}");

// Create the time series collection
mongoc_database_create_collection (database, "october2024", opts, &error);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
mongoc_database_create_collection (database, "october2024", opts, &error);
mongoc_collection_t *collection = mongoc_database_create_collection (database, "october2024", opts, &error);

Suggest saving the result of the function call in a variable. collection is used in mongoc_collection_insert_one below.

Comment on lines 51 to 52
const bson_t *insert_doc;
insert_doc = BCON_NEW (
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
const bson_t *insert_doc;
insert_doc = BCON_NEW (
const bson_t *insert_doc = BCON_NEW (

int main (int argc, char *argv[])
{
// start-create-time-series
bson_error_t error;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest moving error closer to mongoc_database_create_collection where it is being used.

mongoc_collection_insert_one (collection, insert_doc, NULL, NULL, &error))
// end-insert-document

bson_destroy (opts);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
bson_destroy (opts);


// Create the time series collection
mongoc_database_create_collection (database, "october2024", opts, &error);
// end-create-time-series
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// end-create-time-series
bson_destroy (opts);
// end-create-time-series

bson_destroy (opts);
mongoc_cursor_destroy (cursor);
mongoc_database_destroy (database);
mongoc_client_destroy (client);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
mongoc_client_destroy (client);
mongoc_client_destroy (client);
mongoc_collection_destroy (collection);

// end-insert-document

bson_destroy (opts);
mongoc_cursor_destroy (cursor);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
mongoc_cursor_destroy (cursor);

if (mongoc_cursor_error (cursor, &error))
{
fprintf (stderr, "Cursor error: %s\n", error.message);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
}
}
mongoc_cursor_destroy (cursor);

"location", "{", "city", BCON_UTF8 ("New York"), "}",
"timestamp", BCON_DATE_TIME (1633046400000));

if (!mongoc_collection_insert_one (collection, insert_doc, NULL, NULL, &error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
if (!mongoc_collection_insert_one (collection, insert_doc, NULL, NULL, &error) {
if (!mongoc_collection_insert_one (collection, insert_doc, NULL, NULL, &error)) {

"timestamp", BCON_DATE_TIME (1633046400000));

if (!mongoc_collection_insert_one (collection, insert_doc, NULL, NULL, &error) {
fprintf("Error inserting document: %s\n", error.message);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
fprintf("Error inserting document: %s\n", error.message);
fprintf(stderr, "Error inserting document: %s\n", error.message);

Comment on lines 30 to 31
// end-create-time-series
bson_destroy (opts);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// end-create-time-series
bson_destroy (opts);
bson_destroy (opts);
// end-create-time-series

Suggest swapping these two lines so the user can see in documentation that they have to destroy the opts variable.

Copy link
Collaborator

@joshbsiegel joshbsiegel left a comment

Choose a reason for hiding this comment

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

LGTM

@jordan-smith721 jordan-smith721 merged commit ea7a6ff into mongodb:standardization Oct 4, 2024
4 of 5 checks passed
@jordan-smith721 jordan-smith721 deleted the DOCSP-43063-time-series branch October 4, 2024 16:49
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