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-26735): C++: Add a Quick Start page #2575

Merged
merged 2 commits into from
Feb 10, 2023

Conversation

dacharyc
Copy link
Collaborator

@dacharyc dacharyc commented Feb 9, 2023

Pull Request Info

As part of this work, I removed the "LINQ" reference in the include that was shared across all the SDKs, and replaced it with the more generic "the SDK's query engine."

Jira

Staged Changes

Reminder Checklist

If your PR modifies the docs, you might need to also update some corresponding
pages. Check if completed or N/A.

  • Create Jira ticket for corresponding docs-app-services update(s), if any
  • Checked/updated Admin API
  • Checked/updated CLI reference

Review Guidelines

REVIEWING.md

@github-actions
Copy link

github-actions bot commented Feb 9, 2023

Readability for Commit Hash: dfd230b

You can see any previous Readability scores (if they exist) by looking
at the comment's history.

Flesch Reading Ease scores for changed documents:

  • source/sdk/cpp: 24.64
  • source/sdk/cpp/application-services: 48.3
  • source/sdk/cpp/quick-start: 64.3
  • source/sdk/cpp/model-data/object-models: 55.84
  • examples/cpp/CMakeLists: -111.94

The following table can be helpful in assessing the readability score of a document.

Score Difficulty
90-100 Very Easy
80-89 Easy
70-79 Fairly Easy
60-69 Medium
50-59 Fairly Hard
30-49 Hard
0-29 Very Hard

CHECK(*todoToUpdate.status == "Complete");

// :snippet-start: delete
realm.write([&realm, &todo] {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@cbush

If I replace this delete block with this code, instead:

 auto todoToDelete = todos[0];
 realm.write([&realm, &todoToDelete] {
     realm.remove(todoToDelete);
 });

I get this error:

/Users/dachary.carey/workspace/docs-realm/examples/cpp/quick-start.cpp:47: FAILED:
  {Unknown expression after the reported line}
due to unexpected exception with message:
  Index out of range.

I would expect it to work because in line 66 above, we verify that todos contains an item. I am assuming it has failed because of memory/unique_ptr shenanigans between 66 and here, but I could be misinterpreting this entirely.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nothing in your alternate code sticks out as wrong to me. Might be worth bringing this up with the SDK team to see if this is a known issue?

Copy link
Collaborator

@cbush cbush left a comment

Choose a reason for hiding this comment

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

A few comments... looks good so far!

examples/cpp/CMakeLists.txt Outdated Show resolved Hide resolved
examples/cpp/quick-start.cpp Outdated Show resolved Hide resolved
examples/cpp/quick-start.cpp Outdated Show resolved Hide resolved
// For this example, get the userId for the Flexible Sync query
auto userId = user.identifier();
auto subscriptions = realm.subscriptions();
auto updateSubscriptionSuccess = subscriptions.update([&](realm::mutable_sync_subscription_set &subs) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this work?

Suggested change
auto updateSubscriptionSuccess = subscriptions.update([&](realm::mutable_sync_subscription_set &subs) {
auto updateSubscriptionSuccess = subscriptions.update([&](auto &subs) {

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems that works in above where I'm clearing all subscriptions, but when I try to use it with add, I get this error:

/Users/dachary.carey/workspace/docs-realm/examples/cpp/quick-start.cpp:133:14: error: use 'template' keyword to treat 'add' as a dependent template name
        subs.add<Sync_Todo>("todos", [&userId](auto &obj) {
             ^
             template

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, nevermind!

examples/cpp/quick-start.cpp Outdated Show resolved Hide resolved
examples/cpp/quick-start.cpp Outdated Show resolved Hide resolved
@dacharyc dacharyc requested a review from cbush February 9, 2023 22:21
@dacharyc dacharyc merged commit 2146856 into mongodb:master Feb 10, 2023
@dacharyc dacharyc deleted the DOCSP-26735 branch February 10, 2023 18:21
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