-
Notifications
You must be signed in to change notification settings - Fork 89
(DOCSP-39539): Consolidate Stream Data to Atlas page #3268
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
Merged
dacharyc
merged 10 commits into
mongodb:feature-consolidated-sdk-docs
from
dacharyc:DOCSP-39539
May 24, 2024
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
87c5333
Draft Stream Data to Atlas page
dacharyc 2600e18
Remove 'Realm' from .NET App ID placeholder
dacharyc 9353a05
Fix snooty build errors
dacharyc b7ba34b
DOCSP-39161 .NET updateBaseURL (#3246)
lindseymoore 7b6468d
Fix snooty build error
dacharyc 8182182
Fix snooty build error
dacharyc f28dc05
Fix incorrect code block and broken Kotlin API reference links
dacharyc 7c4b40d
Update C++ tab ID to use new tab group ID
dacharyc 42c4ed1
Apply suggestions from review
dacharyc 178f5af
Incorporate review feedback
dacharyc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using NUnit.Framework; | ||
using Realms; | ||
using Realms.Sync; | ||
using Realms.Sync.Exceptions; | ||
using Realms.Sync.Testing; | ||
using Realms.Logging; | ||
using System.Threading; | ||
|
||
//:snippet-start: experimental-import | ||
using System.Diagnostics.CodeAnalysis; | ||
//:snippet-end: | ||
|
||
namespace Examples | ||
{ | ||
public class BaseURLChange | ||
{ | ||
|
||
[Test] | ||
|
||
public async Task testEdgeAppWithCustomBaseURL() | ||
{ | ||
var YOUR_APP_ID = "sync-edge-server-cskhoow"; | ||
|
||
// :snippet-start: custom-base-url | ||
// Specify a base URL to connect to a server other than the default. | ||
var appConfig = new AppConfiguration(YOUR_APP_ID); | ||
appConfig.BaseUri = new Uri("http://localhost:80"); | ||
|
||
var app = App.Create(appConfig); | ||
// :snippet-end: | ||
|
||
try { | ||
var user = await app.LogInAsync(Credentials.Anonymous()); | ||
Assert.AreEqual(UserState.LoggedIn, user.State); | ||
await user.LogOutAsync(); | ||
} | ||
catch (Exception e) { | ||
Console.WriteLine(e.Message); | ||
Assert.AreEqual(e.Message, "Could not connect to the server."); | ||
} | ||
|
||
} | ||
|
||
[Test] | ||
|
||
public async Task testChangeBaseURL() | ||
{ | ||
var YOUR_APP_ID = "sync-edge-server-cskhoow"; | ||
|
||
// :snippet-start: update-base-url | ||
// Specify a baseURL to connect to a server other than the default. | ||
// In this case, an Edge Server instance running on the device | ||
var appConfig = new AppConfiguration(YOUR_APP_ID); | ||
appConfig.BaseUri = new Uri("http://localhost:80"); | ||
|
||
var app = App.Create(appConfig); | ||
|
||
// ... log in a user and use the app ... | ||
|
||
// Update the base URL back to the default. | ||
#pragma warning disable Rlm001 // suppress the warning for the experimental method | ||
|
||
await app.UpdateBaseUriAsync(new Uri("https://services.cloud.mongodb.com")); | ||
|
||
#pragma warning restore Rlm001 | ||
// :snippet-end: | ||
|
||
try { | ||
var user = await app.LogInAsync(Credentials.Anonymous()); | ||
Assert.AreEqual(UserState.LoggedIn, user.State); | ||
|
||
await user.LogOutAsync(); | ||
} | ||
catch (Exception e) { | ||
Console.WriteLine(e.Message); | ||
Assert.AreEqual(e.Message, "With a base URL pointing to the cloud, logging in should not fail."); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
source/examples/generated/dotnet/Asymmetrics.snippet.asymmetry.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
source/examples/generated/dotnet/Asymmetrics.snippet.configure-and-open-db.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
var config = new FlexibleSyncConfiguration(user) | ||
{ | ||
Schema = new[] { typeof(Measurement) } | ||
}; | ||
|
||
realm = Realm.GetInstance(config); |
3 changes: 3 additions & 0 deletions
3
source/examples/generated/dotnet/Asymmetrics.snippet.connect-and-authenticate.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
App app = App.Create(myAppId); | ||
Realms.Sync.User user = app.LogInAsync( | ||
Credentials.Anonymous()).Result; |
7 changes: 7 additions & 0 deletions
7
source/examples/generated/dotnet/Asymmetrics.snippet.define-asymmetric-object.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
private partial class Measurement : IAsymmetricObject | ||
{ | ||
[PrimaryKey, MapTo("_id")] | ||
public Guid Id { get; private set; } = Guid.NewGuid(); | ||
public double Value { get; set; } | ||
public DateTimeOffset Timestamp { get; private set; } = DateTimeOffset.UtcNow; | ||
} |
5 changes: 5 additions & 0 deletions
5
source/examples/generated/dotnet/BaseURLChange.snippet.custom-base-url.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Specify a base URL to connect to a server other than the default. | ||
var appConfig = new AppConfiguration(YOUR_APP_ID); | ||
appConfig.BaseUri = new Uri("http://localhost:80"); | ||
|
||
var app = App.Create(appConfig); |
1 change: 1 addition & 0 deletions
1
source/examples/generated/dotnet/BaseURLChange.snippet.experimental-import.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
using System.Diagnostics.CodeAnalysis; |
15 changes: 15 additions & 0 deletions
15
source/examples/generated/dotnet/BaseURLChange.snippet.update-base-url.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Specify a baseURL to connect to a server other than the default. | ||
// In this case, an Edge Server instance running on the device | ||
var appConfig = new AppConfiguration(YOUR_APP_ID); | ||
appConfig.BaseUri = new Uri("http://localhost:80"); | ||
|
||
var app = App.Create(appConfig); | ||
|
||
// ... log in a user and use the app ... | ||
|
||
// Update the base URL back to the default. | ||
#pragma warning disable Rlm001 // suppress the warning for the experimental method | ||
|
||
await app.UpdateBaseUriAsync(new Uri("https://services.cloud.mongodb.com")); | ||
|
||
#pragma warning restore Rlm001 |
2 changes: 2 additions & 0 deletions
2
...udes/api-details/cpp/sync/stream-data-create-asymmetric-objects-description.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Once you have an open database, you can create an ``asymmetric_object`` | ||
and set its values as you would a regular object. |
6 changes: 6 additions & 0 deletions
6
...ludes/api-details/cpp/sync/stream-data-define-asymmetric-object-description.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
You can sync data unidirectionally when you declare an object's | ||
schema as a ``REALM_ASYMMETRIC_SCHEMA``. | ||
|
||
For more information on how to define a ``REALM_ASYMMETRIC_SCHEMA``, | ||
including limitations when linking to other object types, refer to | ||
:ref:`Define an Asymmetric Object <sdks-asymmetric-objects>`. |
9 changes: 9 additions & 0 deletions
9
source/includes/api-details/cpp/sync/stream-data-open-database-description.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Unlike opening a database for non-asymmetric object types, when you open a | ||
database for Data Ingest, you *must* specify the ``asymmetric_object`` types | ||
you want to sync. | ||
|
||
.. tip:: Mixed Object and Asymmetric Object Types | ||
|
||
You cannot open a single synced database to manage both regular objects | ||
and asymmetric objects. You must use different databases to manage these | ||
different object types. |
4 changes: 4 additions & 0 deletions
4
...s/api-details/csharp/sync/stream-data-create-asymmetric-objects-description.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
The process for writing asymmetric objects is the same as standard | ||
bi-directional Sync. The following code shows creating an asymmetric object | ||
and syncing it with the backend. It also shows to queries that generate | ||
errors. |
7 changes: 7 additions & 0 deletions
7
...es/api-details/csharp/sync/stream-data-define-asymmetric-object-description.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
To define an asymmetric object, your objects must implement the | ||
:dotnet-sdk:`IAsymmetricObject <reference/Realms.IAsymmetricObject.html>` | ||
interface or derive from the | ||
:dotnet-sdk:`AsymmetricObject <reference/Realms.AsymmetricObject.html>` class. | ||
|
||
For more information on how to define an asymmetric object, refer to | ||
:ref:`sdks-asymmetric-objects`. |
2 changes: 2 additions & 0 deletions
2
...des/api-details/dart/sync/stream-data-create-asymmetric-objects-description.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Once you have an open database, you can create an asymmetric object inside | ||
a write transaction. Pass your object data to ``realm.ingest``. |
5 changes: 5 additions & 0 deletions
5
...udes/api-details/dart/sync/stream-data-define-asymmetric-object-description.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
To define an asymmetric object, pass ``ObjectType.asymmetricObject`` to | ||
``@RealmModel()``. | ||
|
||
For more information on how to define an asymmetric object, refer to | ||
:ref:`sdks-asymmetric-objects`. |
4 changes: 4 additions & 0 deletions
4
...etails/generic/sync/stream-data-create-asymmetric-objects-js-ts-description.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Once you have an open database, you can create an asymmetric object inside | ||
a write transaction using :js-sdk:`Realm.create() <classes/Realm-1.html#create>`. | ||
When creating an asymmetric object, ``Realm.create()`` returns | ||
``undefined`` rather than the object itself. |
7 changes: 7 additions & 0 deletions
7
...details/generic/sync/stream-data-define-asymmetric-object-js-ts-description.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Asymmetric objects sync data unidirectionally. Define an asymmetric object | ||
by setting ``asymmetric`` to ``true`` in your object schema. For more | ||
information, refer to the :js-sdk:`BaseObjectSchema API reference | ||
<types/BaseObjectSchema.html>`. | ||
|
||
For more information on how to define an asymmetric object, refer to | ||
:ref:`Define an Asymmetric Object <sdks-asymmetric-objects>`. |
3 changes: 3 additions & 0 deletions
3
...s/api-details/kotlin/sync/stream-data-create-asymmetric-objects-description.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Once you have an open database, you can create an ``AsymmetricRealmObject`` | ||
inside a write transaction using the :kotlin-sync-sdk:`insert() <io.realm.kotlin.mongodb.ext/insert.html>` | ||
dacharyc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
extension method: |
8 changes: 8 additions & 0 deletions
8
...es/api-details/kotlin/sync/stream-data-define-asymmetric-object-description.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
You can sync data unidirectionally when that object is an | ||
``AsymmetricRealmObject``. | ||
|
||
Define an asymmetric object by implementing the | ||
:kotlin-sync-sdk:`AsymmetricRealmObject <io.realm.kotlin.types/-asymmetric-realm-object/index.html>` | ||
interface. | ||
|
||
.. include:: /includes/kotlin-asymmetric-object.rst |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this really doesn't seem like a
tip
to me. I'd argue it should be incorporated into the above copy.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion about this. But I think it gets into subjective editorializing, which I don't think we necessarily have time to do as part of this project given the massive chunk of work that it represents. I think we should avoid rewriting/editing as much as possible, unless it's required to make the consolidated content work on the page.