-
Notifications
You must be signed in to change notification settings - Fork 88
(DOCSP-39535): Consolidate Manage Sync Subscriptions page #3320
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 26 commits into
mongodb:feature-consolidated-sdk-docs
from
dacharyc:DOCSP-39535
Aug 1, 2024
Merged
Changes from 23 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
13dffdb
Scaffold Sync Subscriptions page
dacharyc 3dc1603
Fix snooty build errors to get to a clean build
dacharyc da08965
Merge branch 'feature-consolidated-sdk-docs' into DOCSP-39535
dacharyc 798ffab
Add subscribe to query with name section
dacharyc 3340d72
Add wait for sync details
dacharyc 2556731
Add details about unsubscribing from queries
dacharyc 210bb7e
Move Swift-specific info into a Swift include
dacharyc 260c3a7
Add info about adding subscriptions
dacharyc 92deef7
Fix snooty build errors
dacharyc 5e8cbbe
Add details about setting initial subscriptions
dacharyc e1f1678
Add details around duplicate subscriptions
dacharyc 84a55a3
Add details about waiting for subscription changes to sync
dacharyc 111e12a
Add info about Subscription Set State
dacharyc cd33196
Fix name
dacharyc 2b7f3f7
No, really, fix the include file name
dacharyc fa41759
Add details about updating subscriptions
dacharyc a911373
Add details about removing subscriptions
dacharyc 5a6dd36
Fix snooty build errors
dacharyc 2109d0f
Update remaining page content for Realm/Flexible Sync naming
dacharyc a70b96d
Updates per author checklist
dacharyc e9007a8
Add info about accessing and finding subscriptions
dacharyc ba66828
Add info about refreshing realm for C++ and fix snooty build errors
dacharyc 646dac9
Fix broken links
dacharyc 94d00db
Apply suggestions from review
dacharyc 2d42085
Fix missed copy-paste and bullet formatting issue
dacharyc aded9c3
Fix cpp-sdk ID in code example include
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
7 changes: 7 additions & 0 deletions
7
...ails/cpp/sync/manage-sync-subscriptions-access-subscription-set-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 @@ | ||
You can access the subscription set through the ``subscriptions()`` public | ||
member function of a :cpp-sdk:`realm <structrealm_1_1db.html>`. This | ||
provides the :cpp-sdk:`sync_subscription_set | ||
<structrealm_1_1sync__subscription__set.html>` where you can use the | ||
``size()``, ``find()``, or ``update()`` member functions. You perform all | ||
operations to add, find, update, remove, or watch subscriptions through this | ||
property. |
10 changes: 10 additions & 0 deletions
10
...api-details/cpp/sync/manage-sync-subscriptions-add-subscription-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,10 @@ | ||
To add a subscription: | ||
|
||
1. Open the synced database. | ||
#. Access the database's ``subscriptions`` property. | ||
#. Open a subscription ``update`` block. | ||
#. Call the ``add`` method with the object type to append the new subscription | ||
to the subscription set. Optionally, add a query to subscribe to only a | ||
subset of the objects that match the query. | ||
|
||
.. include:: /includes/note-cpp-supports-subset-of-rql.rst |
8 changes: 8 additions & 0 deletions
8
...ls/cpp/sync/manage-sync-subscriptions-change-named-subscription-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 @@ | ||
To update a subscription set, use the ``subscription().updates()`` function. | ||
This gives you access to a :cpp-sdk:`mutable_sync_subscription_set | ||
<structrealm_1_1mutable__sync__subscription__set.html>` where you can use the | ||
``update_subscription()`` function to update a specific :cpp-sdk:`sync_subscription | ||
<structrealm_1_1sync__subscription.html>`. | ||
|
||
You can change a ``sync_subscription``'s query in an update. You can add, remove, | ||
or update the query string for a given ``sync_subscription``. |
7 changes: 7 additions & 0 deletions
7
...pp/sync/manage-sync-subscriptions-change-unnamed-subscription-not-supported.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 @@ | ||
C++ does not provide the ability to change an unnamed subscription. If you know | ||
in advance that your app may need to change subscriptions, :ref:`create the | ||
subscription with a name <sdks-add-named-subscription>`. | ||
|
||
Alternately, you can :ref:`remove all subscriptions | ||
<sdks-remove-all-subscriptions>`, and :ref:`create new subscriptions | ||
<sdks-sync-subscriptions-add-subscription>` with the desired query. |
4 changes: 4 additions & 0 deletions
4
...pi-details/cpp/sync/manage-sync-subscriptions-find-subscription-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 @@ | ||
To find a specific subscription, call the ``subscriptions().find()`` method | ||
with the name of a subscription. | ||
|
||
You cannot find unnamed subscriptions in C++. |
6 changes: 6 additions & 0 deletions
6
...es/api-details/cpp/sync/manage-sync-subscriptions-refresh-realm-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 @@ | ||
After you update subscriptions, call ``refresh()`` on the :cpp-sdk:`realm | ||
<structrealm_1_1db.html>`. This updates the database and outstanding objects | ||
managed by the database to point to the most recent data. | ||
|
||
.. literalinclude:: /examples/generated/cpp/flexible-sync.snippet.refresh-the-realm.cpp | ||
:language: cpp |
2 changes: 2 additions & 0 deletions
2
...ils/cpp/sync/manage-sync-subscriptions-remove-all-subscriptions-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 @@ | ||
You can remove all subscriptions in a subscription set using the ``clear()`` | ||
function. |
8 changes: 8 additions & 0 deletions
8
...ge-sync-subscriptions-remove-all-subscriptions-to-object-type-not-supported.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 @@ | ||
C++ does not provide the ability to remove all subscriptions to a specific | ||
object type. If you know in advance that your app may need to remove | ||
subscriptions, :ref:`create the subscription with a name | ||
<sdks-add-named-subscription>`. | ||
|
||
Alternately, you can :ref:`remove all subscriptions | ||
<sdks-remove-all-subscriptions>`, and then :ref:`add subscriptions | ||
<sdks-sync-subscriptions-add-subscription>` that your app still needs. |
5 changes: 5 additions & 0 deletions
5
...nc/manage-sync-subscriptions-remove-all-unnamed-subscriptions-not-supported.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 @@ | ||
C++ does not provide the ability to remove all unnamed subscriptions. | ||
|
||
Instead, you can :ref:`remove all subscriptions | ||
<sdks-remove-all-subscriptions>`, and then :ref:`add subscriptions | ||
<sdks-sync-subscriptions-add-subscription>` that your app still needs. |
4 changes: 4 additions & 0 deletions
4
...ls/cpp/sync/manage-sync-subscriptions-remove-named-subscription-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 @@ | ||
You can remove a specific subscription by name using the ``remove()`` function | ||
inside a ``subscription().updates()`` block. Removing a subscription by name | ||
throws an error if the subscription does not exist, so you should check for a | ||
subscription before removing it. |
7 changes: 7 additions & 0 deletions
7
...nc/manage-sync-subscriptions-remove-subscription-by-reference-not-supported.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 @@ | ||
C++ does not provide the ability to remove a subscription by reference. If | ||
you know in advance that your app may need to remove subscriptions, | ||
:ref:`create the subscription with a name <sdks-add-named-subscription>`. | ||
|
||
Alternately, you can :ref:`remove all subscriptions | ||
<sdks-remove-all-subscriptions>`, and then :ref:`add subscriptions | ||
<sdks-sync-subscriptions-add-subscription>` that your app still needs. |
7 changes: 7 additions & 0 deletions
7
...pp/sync/manage-sync-subscriptions-remove-unnamed-subscription-not-supported.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 @@ | ||
C++ does not provide the ability to remove a single unnamed subscription. If | ||
you know in advance that your app may need to remove subscriptions, | ||
:ref:`create the subscription with a name <sdks-add-named-subscription>`. | ||
|
||
Alternately, you can :ref:`remove all subscriptions | ||
<sdks-remove-all-subscriptions>`, and then :ref:`add subscriptions | ||
<sdks-sync-subscriptions-add-subscription>` that your app still needs. |
1 change: 1 addition & 0 deletions
1
...ils/cpp/sync/manage-sync-subscriptions-subscription-set-state-not-supported.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 @@ | ||
C++ does not currently provide an API to check the state of a subscription set. |
1 change: 1 addition & 0 deletions
1
...nage-sync-subscriptions-wait-for-subscription-changes-to-sync-not-supported.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 @@ | ||
C++ does not currently provide an API to wait for subscription changes to sync. |
5 changes: 5 additions & 0 deletions
5
...s/csharp/sync/manage-sync-subscriptions-access-subscription-set-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 @@ | ||
You can access the :dotnet-sdk:`SubscriptionSet | ||
<reference/Realms.Sync.SubscriptionSet.html>` through the database | ||
:dotnet-sdk:`Subscriptions <reference/Realms.Realm.html#Realms_Realm_Subscriptions>` | ||
property. You perform all operations to add, find, update, remove, or watch | ||
subscriptions through this property. |
20 changes: 20 additions & 0 deletions
20
...-details/csharp/sync/manage-sync-subscriptions-add-subscription-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,20 @@ | ||
To add a subscription: | ||
|
||
1. Open the synced database. | ||
#. Access the database's :dotnet-sdk:`Realm.Subscriptions <reference/Realms.Realm.html#Realms_Realm_Subscriptions>` | ||
property. | ||
#. Open a subscription ``Update`` block. | ||
#. Create a subscription to a specific object type. Optionally add a query to | ||
subscribe to only a subset of the objects that match the query. | ||
#. Call the ``Subscriptions.Add`` method with the subscription you just created | ||
to append the new subscription to the subscription set. | ||
|
||
Alternately, to add a subscription to an existing subscription set, create | ||
the query and then call :dotnet-sdk:`IQueryable.SubscribeAsync() | ||
<reference/Realms.CollectionExtensions.html#Realms_CollectionExtensions_SubscribeAsync__1_System_Linq_IQueryable___0__Realms_Sync_SubscriptionOptions_Realms_Sync_WaitForSyncMode_System_Nullable_System_Threading_CancellationToken__>`. | ||
|
||
The ``SubscribeAsync`` method is shorthand for using :dotnet-sdk:`SubscriptionSet.Update() | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_Update_System_Action_>` | ||
to create an update block, and then calling the :dotnet-sdk:`SubscriptionSet.Add() | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_Add__1_System_Linq_IQueryable___0__Realms_Sync_SubscriptionOptions_>` | ||
method on the ``SubscriptionSet``. |
12 changes: 12 additions & 0 deletions
12
...csharp/sync/manage-sync-subscriptions-change-named-subscription-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,12 @@ | ||
You can update a named subscription with a new query. To update a subscription's | ||
query, pass the new query and a subscription option with the name of the | ||
subscription that you want to update to the | ||
``SubscriptionSet.Add()`` method. Like adding a new subscription, | ||
you must update a subscription within an update block by calling | ||
``SubscriptionSet.Update()`` method. | ||
|
||
The ``SubscriptionOptions.UpdateExisting`` field must be set to ``true``, or | ||
else attempting to change the subscription throws an exception. | ||
|
||
In the following example, long running tasks are re-defined to be any tasks that | ||
have taken more than 130 minutes. |
7 changes: 7 additions & 0 deletions
7
...rp/sync/manage-sync-subscriptions-change-unnamed-subscription-not-supported.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 @@ | ||
C# does not provide the ability to change an unnamed subscription. If you know | ||
in advance that your app may need to change subscriptions, :ref:`create the | ||
subscription with a name <sdks-add-named-subscription>`. | ||
|
||
Alternately, you can :ref:`delete the unnamed subscription | ||
<sdks-remove-subscriptions>`, and :ref:`create a new subscription | ||
<sdks-sync-subscriptions-add-subscription>` with the desired query. |
8 changes: 8 additions & 0 deletions
8
...details/csharp/sync/manage-sync-subscriptions-find-subscription-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 @@ | ||
To find a specific subscription by name, call the | ||
:dotnet-sdk:`Find() <reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_Find_System_String_>` | ||
method with the name of a subscription. | ||
|
||
You can also find a subscription matching a specific query by calling the | ||
:dotnet-sdk:`Find() | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_Find__1_System_Linq_IQueryable___0__>` | ||
method with an IQueryable<T> argument. |
8 changes: 8 additions & 0 deletions
8
.../csharp/sync/manage-sync-subscriptions-remove-all-subscriptions-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 @@ | ||
Within an update block, you can remove all subscriptions from the | ||
subscriptions set. Call the :dotnet-sdk:`RemoveAll() | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_RemoveAll_System_Boolean_>` | ||
method on the ``SubscriptionSet``. | ||
|
||
By default, the ``RemoveAll()`` method only removes unnamed subscriptions. | ||
Set the optional ``removedName`` boolean to ``true`` to also remove named | ||
subscriptions. |
14 changes: 14 additions & 0 deletions
14
...nage-sync-subscriptions-remove-all-subscriptions-to-object-type-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,14 @@ | ||
Within an update block, you can remove remove all unnamed subscriptions of a | ||
class by passing the class name as a string to the | ||
:dotnet-sdk:`RemoveAll("ClassName") | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_RemoveAll_System_String_System_Boolean_>` | ||
method. The ``RemoveAll()`` method has an optional second argument that is a | ||
boolean, ``removedName``, which also removes the named subscriptions if it is | ||
set to ``true``. ``removedName`` is set to false by default. | ||
|
||
Alternatively, you can remove all unnamed subscriptions of an object type | ||
with :dotnet-sdk:`RemoveAll() | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_RemoveAll__1_System_Boolean_>`. | ||
The ``RemoveAll<Type>()`` method has an optional boolean ``removedName`` argument | ||
that also removes the named subscriptions if it is set to ``true``. The ``removedName`` | ||
argument is set to false by default. |
5 changes: 5 additions & 0 deletions
5
...sync/manage-sync-subscriptions-remove-all-unnamed-subscriptions-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 @@ | ||
Within an update block, you can remove all unnamed subscriptions from the | ||
subscriptions set. Call the :dotnet-sdk:`RemoveAll() | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_RemoveAll_System_Boolean_>` | ||
method on the ``SubscriptionSet``, with the optional boolean ``removedName`` | ||
argument set to false. This removes only unnamed subscriptions. |
4 changes: 4 additions & 0 deletions
4
...csharp/sync/manage-sync-subscriptions-remove-named-subscription-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 @@ | ||
Within an update block, you can remove a specific subscription by name. Pass the | ||
name to the :dotnet-sdk:`Remove() | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_Remove_System_String_>` | ||
method on the ``SubscriptionSet``. |
4 changes: 4 additions & 0 deletions
4
...sync/manage-sync-subscriptions-remove-subscription-by-reference-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 @@ | ||
Within an update block, you can remove a specific subscription by reference. | ||
Pass the subscription to the :dotnet-sdk:`Remove() | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_Remove_System_String_>` | ||
method on the ``SubscriptionSet``. |
7 changes: 7 additions & 0 deletions
7
...harp/sync/manage-sync-subscriptions-remove-unnamed-subscription-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 @@ | ||
Within an update block, you can remove an unnamed subscription by its query. | ||
Pass the query to the :dotnet-sdk:`Remove() | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_Remove__1_System_Linq_IQueryable___0__System_Boolean_>` | ||
method on the ``SubscriptionSet``. | ||
|
||
In the following example, the subscription to tasks with an owner named 'Ben' is | ||
removed from the subscriptions set. |
8 changes: 8 additions & 0 deletions
8
...csharp/sync/manage-sync-subscriptions-set-initial-subscriptions-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 bootstrap the database with an initial subscription set | ||
when you open it with a :dotnet-sdk:`FlexibleSyncConfiguration | ||
<reference/Realms.Sync.FlexibleSyncConfiguration.html>`. Set the | ||
:dotnet-sdk:`PopulateInitialSubscriptions | ||
<reference/Realms.Sync.FlexibleSyncConfiguration.html#Realms_Sync_FlexibleSyncConfiguration_PopulateInitialSubscriptions>` | ||
parameter to a callback that is invoked when the database instance is created. | ||
Add the queries you want to use to bootstrap the database, as shown in the | ||
following example. |
9 changes: 9 additions & 0 deletions
9
...ls/csharp/sync/manage-sync-subscriptions-subscription-set-state-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 @@ | ||
Use the :dotnet-sdk:`SubscriptionSet.State | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_State>` | ||
property to read the current state of the subscription set. | ||
|
||
The ``Superseded`` state is a :dotnet-sdk:`SubscriptionSetState | ||
<reference/Realms.Sync.SubscriptionSetState.html>` that can occur when another | ||
thread updates a subscription on a different instance of the subscription set. | ||
If the state becomes ``Superseded``, you must obtain a new instance of the | ||
subscription set before you can update it. |
17 changes: 17 additions & 0 deletions
17
...manage-sync-subscriptions-wait-for-subscription-changes-to-sync-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,17 @@ | ||
Use the :dotnet-sdk:`SubscriptionSet.WaitForSynchronizationAsync() | ||
<reference/Realms.Sync.SubscriptionSet.html#Realms_Sync_SubscriptionSet_WaitForSynchronizationAsync>` | ||
method to wait for the server to acknowledge this set of subscriptions. If the | ||
server rejects the change, the :dotnet-sdk:`SubscriptionSetState | ||
<reference/Realms.Sync.SubscriptionSetState.html>` will be an error state, and | ||
an exception will be thrown. | ||
|
||
An exception may occur if: | ||
|
||
- An unsupported query is subscribed to. Subscribing to an unsupported query | ||
will pause synchronization. To resume synchronization, :ref:`remove the | ||
unsupported query <sdks-remove-subscriptions>`. | ||
|
||
- You are performing an invalid action, such as adding an object that does not | ||
match a subscription. This triggers a :ref:`client reset <client-resets>`: | ||
data is erased from the device, and a new copy of the data is created without | ||
any subscriptions in the set. |
5 changes: 5 additions & 0 deletions
5
...ils/dart/sync/manage-sync-subscriptions-access-subscription-set-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 @@ | ||
you can access a | ||
:flutter-sdk:`SubscriptionSet <realm/SubscriptionSet-class.html>`, a | ||
collection of subscriptions, through the ``Realm.subscriptions`` property. | ||
You perform all operations to add, find, update, remove, or watch | ||
subscriptions through this property. |
11 changes: 11 additions & 0 deletions
11
...pi-details/dart/sync/manage-sync-subscriptions-add-subscription-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,11 @@ | ||
To add a subscription: | ||
|
||
1. Open the synced database. | ||
#. Access the database's ``subscriptions`` property to interact with the | ||
:flutter-sdk:`SubscriptionSet <realm/SubscriptionSet-class.html>`. | ||
#. Open a subscription ``update`` block by calling | ||
:flutter-sdk:`SubscriptionSet.update() <realm/SubscriptionSet/update.html>`. | ||
#. Call the ``add`` method to append the new subscription to the | ||
subscription set. | ||
#. Pass a ``RealmResults`` query that you can create using the | ||
:ref:`Realm Query Language query <rql>`. Optionally, add a query name. |
10 changes: 10 additions & 0 deletions
10
...s/dart/sync/manage-sync-subscriptions-change-named-subscription-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,10 @@ | ||
You can update a named subscription with a new query. To update a subscription's | ||
query, open an update block with ``SubscriptionSet.update()``. | ||
In the callback function of the update block, pass the following arguments to ``MutableSubscriptionSet.add()``: | ||
|
||
- The new query | ||
- The name of the subscription that you want to update | ||
- ``update: true`` | ||
|
||
In the following example, long trains are re-defined to be any trains that | ||
have more than 10 cars. |
7 changes: 7 additions & 0 deletions
7
...rt/sync/manage-sync-subscriptions-change-unnamed-subscription-not-supported.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 @@ | ||
Dart does not provide the ability to change an unnamed subscription. If you | ||
know in advance that your app may need to change subscriptions, :ref:`create | ||
the subscription with a name <sdks-add-named-subscription>`. | ||
|
||
Alternately, you can :ref:`delete the unnamed subscription | ||
<sdks-remove-subscriptions>`, and :ref:`create a new subscription | ||
<sdks-sync-subscriptions-add-subscription>` with the desired query. |
3 changes: 3 additions & 0 deletions
3
...ils/dart/sync/manage-sync-subscriptions-duplicate-subscriptions-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 @@ | ||
If you add a duplicate **unnamed** subscription with the same query, the SDK | ||
automatically removes it; adding an identical **named** subscription is a | ||
no-op. Therefore, in both cases, duplicate subscriptions are ignored. |
7 changes: 7 additions & 0 deletions
7
...i-details/dart/sync/manage-sync-subscriptions-find-subscription-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 find a specific subscription by name, call the | ||
:flutter-sdk:`findByName() <realm/SubscriptionSet/findByName.html>` | ||
method with the name of a subscription. | ||
|
||
You can also find a subscription matching a specific query by calling the | ||
:flutter-sdk:`find() <realm/SubscriptionSet/find.html>` method with an | ||
RQL query. |
2 changes: 2 additions & 0 deletions
2
...ls/dart/sync/manage-sync-subscriptions-remove-all-subscriptions-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 @@ | ||
Within a subscription update block, you can remove all subscriptions from the | ||
subscriptions set with :flutter-sdk:`MutableSubscriptionSet.clear() <realm/MutableSubscriptionSet/clear.html>`. |
3 changes: 3 additions & 0 deletions
3
...nage-sync-subscriptions-remove-all-subscriptions-to-object-type-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 @@ | ||
You can remove all subscriptions for a given SDK object type. Within a | ||
subscription update block, call | ||
:flutter-sdk:`MutableSubscriptionSet.removeByType() <realm/MutableSubscriptionSet/removeByType.html>`. |
4 changes: 4 additions & 0 deletions
4
...sync/manage-sync-subscriptions-remove-all-unnamed-subscriptions-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 @@ | ||
Within a subscription update block, you can remove all unnamed subscriptions | ||
from the subscriptions set by calling :flutter-sdk:`MutableSubscriptionSet.clear() | ||
<realm/MutableSubscriptionSet/clear.html>` with an ``unnamedOnly`` argument | ||
set to ``true``. |
3 changes: 3 additions & 0 deletions
3
...s/dart/sync/manage-sync-subscriptions-remove-named-subscription-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 @@ | ||
Within an update block, you can remove a specific subscription by name. Pass | ||
the name to :flutter-sdk:`MutableSubscriptionSet.removeByName() | ||
<realm/MutableSubscriptionSet/removeByName.html>`. |
4 changes: 4 additions & 0 deletions
4
...sync/manage-sync-subscriptions-remove-subscription-by-reference-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 @@ | ||
You can remove a subscription if you have a reference to its :flutter-sdk:`Subscription | ||
<realm/Subscription-class.html>` object. | ||
Within a subscription update block, pass the ``Subscription`` reference to | ||
:flutter-sdk:`MutableSubscriptionSet.remove() <realm/MutableSubscriptionSet/remove.html>`. |
6 changes: 6 additions & 0 deletions
6
...dart/sync/manage-sync-subscriptions-remove-unnamed-subscription-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 @@ | ||
Within an update block, you can remove a specific subscription by query. | ||
Open an update block with ``SubscriptionSet.update()``. Pass the | ||
``Subscription`` to :flutter-sdk:`MutableSubscriptionSet.removeByQuery() | ||
<realm/MutableSubscriptionSet/removeByQuery.html>`. | ||
|
||
In the following example, the subscription for all ``Plane`` objects is removed. |
11 changes: 11 additions & 0 deletions
11
...-details/dart/sync/manage-sync-subscriptions-subscribe-to-query-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,11 @@ | ||
To subscribe to a query, pass the following arguments to ``subscribe()``: | ||
|
||
- ``RealmResults query``: Required. A ``RealmResults`` object that you can | ||
create using the :ref:`Realm Query Language <rql>`. | ||
- ``String name``: Optional. Name for the subscription that you can refer to. | ||
- ``bool update``: Optional. When true, adding a subscription with an existing | ||
name replaces the existing query with the new query. When false, the SDK | ||
throws an exception for duplicate subscriptions. Only use with named | ||
subscriptions. | ||
|
||
In the following example, we subscribe to two new named queries. |
7 changes: 7 additions & 0 deletions
7
...art/sync/manage-sync-subscriptions-subscribe-to-query-with-name-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 subscribe to a query with a name, pass the following arguments to ``subscribe()``: | ||
|
||
- ``RealmResults query``: Required. A ``RealmResults`` object that you can create using the | ||
:ref:`Realm Query Language <rql>`. | ||
- ``String name``: Optional. Name for the subscription that you can refer to. | ||
|
||
In the following example, we subscribe to two new named queries. |
8 changes: 8 additions & 0 deletions
8
...ails/dart/sync/manage-sync-subscriptions-subscription-set-state-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 @@ | ||
Use the :flutter-sdk:`Realm.subscriptions.state <realm/SubscriptionSet/state.html>` | ||
property to read the current state of the subscription set. | ||
|
||
The ``superseded`` state is a :flutter-sdk:`SubscriptionSetState | ||
<realm/SubscriptionSetState.html>` that can occur when another thread updates a | ||
subscription on a different instance of the subscription set. If the state | ||
becomes ``superseded``, you must obtain a new instance of the subscription set | ||
before you can update it. |
2 changes: 2 additions & 0 deletions
2
...ails/dart/sync/manage-sync-subscriptions-unsubscribe-from-query-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 @@ | ||
You can unsubscribe from a query's results using :flutter-sdk:`unsubscribe() | ||
<realm/RealmResultsOfRealmObject/unsubscribe.html>`. |
21 changes: 21 additions & 0 deletions
21
...c/manage-sync-subscriptions-wait-for-query-subscription-to-sync-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,21 @@ | ||
When you do need specify the desired sync behavior, configure the | ||
:flutter-sdk:`waitForSyncMode <realm/WaitForSyncMode.html>` option. | ||
|
||
This example uses the ``firstTime`` option, which is the default behavior. | ||
A subscription with ``firstTime`` behavior only waits for sync to finish when a | ||
subscription is first created. | ||
|
||
.. literalinclude:: /examples/generated/flutter/manage_sync_subscription_test.snippet.wait-first-time-subscribe-api.dart | ||
:language: dart | ||
:emphasize-lines: 5 | ||
|
||
The other supported ``waitForSyncMode`` options are: | ||
|
||
- ``always``: Wait to download matching objects every time your app launches. | ||
The app must have an internet connection at every launch. | ||
- ``never``: Never wait to download matching objects. The app needs an internet | ||
connection for the user to authenticate the first time the app launches, but | ||
can open offline on subsequent launches using cached credentials. | ||
|
||
You can optionally specify a :flutter-sdk:`cancellationToken <realm/CancellationToken-class.html>` | ||
to limit how long the sync download runs. |
11 changes: 11 additions & 0 deletions
11
...manage-sync-subscriptions-wait-for-subscription-changes-to-sync-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,11 @@ | ||
Use :flutter-sdk:`Realm.subscriptions.waitForSynchronization() <realm/SubscriptionSet/waitForSynchronization.html>` | ||
to wait for the server to acknowledge this set of subscriptions. | ||
If the server rejects the change, and an exception is thrown. | ||
|
||
An exception may occur if: | ||
|
||
- You subscribe to an unsupported query. Subscribing to an unsupported query will pause synchronization. | ||
To resume synchronization, :ref:`remove the unsupported query <sdks-remove-subscriptions>`. | ||
- You are performing an invalid action, such as adding an object that does not match a subscription. | ||
This triggers a :ref:`client reset <client-resets>`: data is erased from the device, | ||
and a new copy of the data is created without any subscriptions in the set. |
3 changes: 3 additions & 0 deletions
3
...eric/sync/manage-sync-subscriptions-set-initial-subscriptions-not-supported.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 @@ | ||
The selected language does not provide a dedicated API to set initial | ||
subscriptions. Instead, refer to the :ref:`sdks-sync-subscriptions-add-subscription` | ||
section on this page. |
3 changes: 3 additions & 0 deletions
3
...ils/generic/sync/manage-sync-subscriptions-subscribe-to-query-not-supported.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 @@ | ||
The selected language does not support the API that enables you to subscribe | ||
to a query. Instead, refer to :ref:`manually manage queries | ||
<sdks-manually-manage-subscriptions>`. |
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.
Uh oh!
There was an error while loading. Please reload this page.