Skip to content

Commit a0659fc

Browse files
dacharyclindseymooreMongoCalebcbullinger
authored
(DOCSP-39539): Consolidate Stream Data to Atlas page (#3268)
## Pull Request Info - SDK Docs Consolidation Jira ticket: https://jira.mongodb.org/browse/DOCSP-39539 *Staged Page* - [Stream Data to Atlas](https://preview-mongodbdacharyc.gatsbyjs.io/realm/DOCSP-39539/sdk/sync/stream-data-to-atlas/): Draft consolidated page *Page Source* - [C++: Stream Data to Atlas](https://www.mongodb.com/docs/atlas/device-sdks/sdk/cpp/sync/stream-data-to-atlas/) - [Flutter: Stream Data to Atlas](https://www.mongodb.com/docs/atlas/device-sdks/sdk/flutter/sync/stream-data-to-atlas/) - [Kotlin: Stream Data to Atlas](https://www.mongodb.com/docs/atlas/device-sdks/sdk/kotlin/sync/stream-data-to-atlas/) - [.NET: Stream Data to Atlas](https://www.mongodb.com/docs/atlas/device-sdks/sdk/dotnet/sync/asymmetric-sync/) - [Node.js: Stream Data to Atlas](https://www.mongodb.com/docs/atlas/device-sdks/sdk/node/sync/stream-data-to-atlas/) - [Swift: Stream Data to Atlas](https://www.mongodb.com/docs/atlas/device-sdks/sdk/swift/sync/stream-data-to-atlas/) ### PR Author Checklist Before requesting a review for your PR, please check these items: - [x] Open the PR against the `feature-consolidated-sdk-docs` branch instead of `master` - [x] Tag the consolidated page for: - genre - meta.keywords - meta.description #### Naming - [x] Update Realm naming and the language around persistence layer/local/device per [this document](https://docs.google.com/document/d/126OczVxBWAwZ4P5ZsSM29WI3REvONEr1ald-mAwPtyQ/edit?usp=sharing) - [x] Include `.rst` files comply with [the naming guidelines](https://docs.google.com/document/d/1h8cr66zoEVeXytVfvDxlCSsUS5IZwvUQvfSCEXNMpek/edit#heading=h.ulh8b5f2hu9) #### Links and Refs - [x] Create new consolidated SDK ref targets starting with "_sdks-" for relevant sections - [x] Remove or update any SDK-specific refs to use the new consolidated SDK ref targets - [x] [Update any Kotlin API links](https://jira.mongodb.org/browse/DOCSP-32519) to use the new Kotlin SDK roles #### Content - [x] Shared code boxes have snippets or placeholders for all 9 languages - [x] API description sections have API details or a generic placeholder for all 9 languages - [x] Check related pages for relevant content to include - [x] Create a ticket for missing examples in each relevant SDK: Consolidation Gaps epic ### Reviewer Checklist As a reviewer, please check these items: - [ ] Shared code example boxes contain language-specific snippets or placeholders for every language - [ ] API reference details contain working API reference links or generic content - [ ] Realm naming/language has been updated - [ ] All relevant content from individual SDK pages is present on the consolidated page --------- Co-authored-by: lindseymoore <[email protected]> Co-authored-by: MongoCaleb <[email protected]> Co-authored-by: cbullinger <[email protected]>
1 parent 643a481 commit a0659fc

File tree

33 files changed

+516
-59
lines changed

33 files changed

+516
-59
lines changed

examples/dotnet/Examples/Asymmetrics.cs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,26 @@ namespace Examples
1111
{
1212
public partial class Asymmetrics
1313
{
14-
App app;
15-
Realms.Sync.User user;
1614
Realm realm;
17-
const string myRealmAppId = Config.FSAppId;
15+
const string myAppId = Config.FSAppId;
1816

1917
[OneTimeSetUp]
2018
public void Setup()
2119
{
22-
app = App.Create(myRealmAppId);
23-
user = app.LogInAsync(
20+
// :snippet-start: connect-and-authenticate
21+
App app = App.Create(myAppId);
22+
Realms.Sync.User user = app.LogInAsync(
2423
Credentials.Anonymous()).Result;
25-
24+
// :snippet-end:
25+
26+
// :snippet-start: configure-and-open-db
2627
var config = new FlexibleSyncConfiguration(user)
2728
{
2829
Schema = new[] { typeof(Measurement) }
2930
};
3031

31-
3232
realm = Realm.GetInstance(config);
33+
// :snippet-end:
3334

3435
// You cannot add a subscription for an AsymmetricObject
3536
// This causes a compile-time error:
@@ -40,22 +41,18 @@ public void Setup()
4041
//});
4142
// :uncomment-end:
4243
}
43-
44-
// :snippet-start: asymmetry
45-
// :remove-start:
4644
[Realms.Explicit]
47-
// :remove-end:
45+
// :snippet-start: define-asymmetric-object
4846
private partial class Measurement : IAsymmetricObject
4947
{
5048
[PrimaryKey, MapTo("_id")]
5149
public Guid Id { get; private set; } = Guid.NewGuid();
5250
public double Value { get; set; }
5351
public DateTimeOffset Timestamp { get; private set; } = DateTimeOffset.UtcNow;
5452
}
55-
56-
// :remove-start:
53+
// :snippet-end:
5754
[Test]
58-
// :remove-end:
55+
// :snippet-start: asymmetry
5956
public void SendMeasurementToRealm()
6057
{
6158
var measurement = new Measurement

source/examples/generated/dotnet/Asymmetrics.snippet.asymmetry.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
private partial class Measurement : IAsymmetricObject
2-
{
3-
[PrimaryKey, MapTo("_id")]
4-
public Guid Id { get; private set; } = Guid.NewGuid();
5-
public double Value { get; set; }
6-
public DateTimeOffset Timestamp { get; private set; } = DateTimeOffset.UtcNow;
7-
}
8-
91
public void SendMeasurementToRealm()
102
{
113
var measurement = new Measurement
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var config = new FlexibleSyncConfiguration(user)
2+
{
3+
Schema = new[] { typeof(Measurement) }
4+
};
5+
6+
realm = Realm.GetInstance(config);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
App app = App.Create(myAppId);
2+
Realms.Sync.User user = app.LogInAsync(
3+
Credentials.Anonymous()).Result;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
private partial class Measurement : IAsymmetricObject
2+
{
3+
[PrimaryKey, MapTo("_id")]
4+
public Guid Id { get; private set; } = Guid.NewGuid();
5+
public double Value { get; set; }
6+
public DateTimeOffset Timestamp { get; private set; } = DateTimeOffset.UtcNow;
7+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Once you have an open database, you can create an ``asymmetric_object``
2+
and set its values as you would a regular object.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
You can sync data unidirectionally when you declare an object's
2+
schema as a ``REALM_ASYMMETRIC_SCHEMA``.
3+
4+
For more information on how to define a ``REALM_ASYMMETRIC_SCHEMA``,
5+
including limitations when linking to other object types, refer to
6+
:ref:`Define an Asymmetric Object <sdks-asymmetric-objects>`.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Unlike opening a database for non-asymmetric object types, when you open a
2+
database for Data Ingest, you *must* specify the ``asymmetric_object`` types
3+
you want to sync.
4+
5+
.. tip:: Mixed Object and Asymmetric Object Types
6+
7+
You cannot open a single synced database to manage both regular objects
8+
and asymmetric objects. You must use different databases to manage these
9+
different object types.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
The process for writing asymmetric objects is the same as standard
2+
bi-directional Sync. The following code shows creating an asymmetric object
3+
and syncing it with the backend. It also shows to queries that generate
4+
errors.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
To define an asymmetric object, your objects must implement the
2+
:dotnet-sdk:`IAsymmetricObject <reference/Realms.IAsymmetricObject.html>`
3+
interface or derive from the
4+
:dotnet-sdk:`AsymmetricObject <reference/Realms.AsymmetricObject.html>` class.
5+
6+
For more information on how to define an asymmetric object, refer to
7+
:ref:`sdks-asymmetric-objects`.

0 commit comments

Comments
 (0)