4.10.0
Release Date: March 14, 2024

4.10.0 New Capabilities

Small Peer User Collection Sync Scopes

User Collection Sync Scopes let you control how data from each user collection is shared with other connected Peers. This is useful when you want to fine-tune which collections do not sync, which collections sync with only the cloud (Big Peer) and which collections sync only with connected Small Peer devices.

Sync scopes can be used to control how documents sync, reduce unnecessary data transfer, and improve performance.

For more information see SDK>Configuring Collection Sync
There is a known issue that once a startSync() is called USER_COLLECTION_SYNC_SCOPES cannot be updated without closing and reopening a new Ditto instance. This will be resolved in the next release. For more information see Updating Sync Scopes

Details

Sync ScopePurpose
”AllPeers” (default)Sync with both the Big Peer and other Small Peers. This is the default behavior for all collections.
”BigPeerOnly”Sync only with the Big Peer. Do no sync with other Small Peers.
”SmallPeersOnly”Sync only with other Small Peers. Do not sync with the Big Peer.
”LocalPeerOnly”Do not sync this collection to the Big Peer or other Small Peers.

DQL Syntax for setting a Sync Scope

DQL
ALTER SYSTEM SET USER_COLLECTION_SYNC_SCOPES = {
    collection_1: "BigPeerOnly",
    collection_2: "SmallPeersOnly",
    collection_3: "LocalPeerOnly"
}

Example Setting A Sync Scope in the SDKs

In the example below we’ll set the collection local_mesh_orders to only sync with other small peers in the mesh and not with the Big Peer using the SmallPeersOnly sync scope.

var syncScopes = [
"local_mesh_orders": "SmallPeersOnly"
];
await ditto.store.execute(
    query: "ALTER SYSTEM SET USER_COLLECTION_SYNC_SCOPES = :syncScopes",
    arguments: ["syncScopes": syncScopes]);

Store Observers Run Multi-Threaded By Default

Ditto store observers (e.g ditto.store.registerObserver(...)) will now run multi-threaded on all platforms (except for in Web Browsers) by default. Prior to 4.10.0 all store observers would run on the same thread which could lead to performance issues for applications with multiple store observers. Users may see performance improvements on applications using more than one store observer, especially during high-volume usage.

Ditto guarantees order sequencing for a single observer. Because observers now run in parallel there is not a guarantee for order sequencing between observers. This behavior change should not have an impact on your application. If you have concerns or questions about this behavior change reach out to Ditto’s Customer Support.

To reset Ditto to only use a single thread for all Ditto observers use the following system parameter. For instruction on how to set a system parameter in your specific SDK see SDK>Customizing System Settings

DQL
ALTER SYSTEM SET STORE_OBSERVERS_NUM_THREADS = 1

DQL Support for LIKE operator

The LIKE operator can now be used for pattern matching of string values.

For more information see DQL>Operator Expressions
PatternMeaning
%Matches zero or more characters (like .* in regex)
_Matches exactly one character (like . in regex)

Example

DQL
SELECT * FROM my_collection
WHERE some_field LIKE 'abc%'

DQL New Objects operators

DQL now supports two new methods for querying over the keys and values in an object.

  • object_keys(object): Returns an array with all the keys in the given object.
  • object_values(object): Returns an array with all the values in object.
For more information see DQL>Operator Expressions

DQL LIMIT/ OFFSET / ORDER BY support for mutation operators

Users can now use LIMIT, OFFSET and ORDER BY in EVICT and UPDATE statements.

DQL Example

DQL
EVICT FROM users
WHERE status = 'inactive'
LIMIT 10;

4.10.0 C# Specific Changelog

4.10.0 Common Changelog

Was this page helpful?