Platform Manual
CRUD Operations

Best Practices for CRUD



Querying Dynamic Data Using $args


Swift
Kotlin
JS
Java
C#
C++
Rust


Batching Multiple Operations





The following snippet demonstrates a batch operation in which two write transactions are contained in a single transaction enclosure:

Swift
Kotlin
JS
Java
C#
C++
Rust


Using ISO-8601 for Date Strings



Implementing Write Strategies



Insert if Absent


Swift
Kotlin
JS
Java
C#
C++
Rust


Insert Default if Absent



The following snippet shows an example of the writeStrategy: insertDefaultIfAbsent parameter passed as an argument to theupsert method:

Swift
Kotlin
JS
Java
C#
C++
Rust


Example Use Case: Upserting Initial Data





Implementing Global Async Transactions



For example, use DispatchQueue.global, as follows:

Swift
Kotlin
JS
Java
C#
C++
Rust


Avoiding Deadlocks



Example of a Deadlock

The following snippet demonstrates a queued write transaction that has the potential to create a deadlock situation. This is because the write transaction initiated on the "people" collection, along with its nested write transaction on the "settings" collection both attempt to acquire resources held by the other:

Swift
Kotlin
JS
Java
C#
C++
Rust


Log Message: Transaction Remains Blocked