Skip to content

Commit

Permalink
Add missing namespace to quick start snippet (#3248)
Browse files Browse the repository at this point in the history
## Pull Request Info

- [Quick
Start](https://preview-mongodbdacharyc.gatsbyjs.io/realm/cpp-add-missing-namespace/sdk/cpp/quick-start/):
Add the missing `namespace` line to the quick start model.

### Reminder Checklist

Before merging your PR, make sure to check a few things.

- [x] Did you tag pages appropriately?
  - genre
  - meta.keywords
  - meta.description
- [x] Describe your PR's changes in the Release Notes section
- [x] Create a Jira ticket for related docs-app-services work, if any

### Release Notes

- **C++ SDK**
  - Quick Start: Fix omitted `namespace` line in the object model.

### Review Guidelines


[REVIEWING.md](https://github.com/mongodb/docs-realm/blob/master/REVIEWING.md)
  • Loading branch information
dacharyc authored May 6, 2024
1 parent a5a5d85 commit 475864c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/cpp/sync/quick-start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ struct Local_Todo {
std::string status;
};
REALM_SCHEMA(Local_Todo, _id, name, status);
} // namespace realm

// :snippet-start: model
namespace realm {
struct Sync_Todo {
realm::primary_key<realm::object_id> _id{realm::object_id::generate()};
std::string name;
Expand All @@ -31,8 +33,8 @@ struct Sync_Todo {
std::string ownerId;
};
REALM_SCHEMA(Sync_Todo, _id, name, status, ownerId);
// :snippet-end:
} // namespace realm
// :snippet-end:

TEST_CASE("non-sync quick start", "[realm][write]") {
auto relative_realm_path_directory = "quick-start/";
Expand Down
2 changes: 2 additions & 0 deletions source/examples/generated/cpp/quick-start.snippet.model.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
namespace realm {
struct Todo {
realm::primary_key<realm::object_id> _id{realm::object_id::generate()};
std::string name;
Expand All @@ -7,3 +8,4 @@ struct Todo {
std::string ownerId;
};
REALM_SCHEMA(Todo, _id, name, status, ownerId);
} // namespace realm

0 comments on commit 475864c

Please sign in to comment.