RealtimeDocumentReference<T> class

A reference to a single document within a collection.

Use this reference to read, subscribe to, update, or delete the document.

Constructors

RealtimeDocumentReference({required MongoRealtime client, required String collection, required String id, required String idField, FromJson<T>? fromJson})

Properties

hashCode → int
The hash code for this object.
no setterinherited
id → String
The document identifier.
no setter
idField → String
The identifier key. Default is _id
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stream → Stream<RealtimeDocument<T>?>
A realtime stream that emits the document when it changes.
no setter
streamWithValue → Stream<T?>
A realtime stream that emits the typed document value when it changes.
no setter
watch ↔ DbWatcher
latefinal

Methods

delete({bool optimistic = false}) → Future<void>
Deletes the document from its collection.
find() → Future<RealtimeDocument<T>?>
Fetches the current state of the document once.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
update({JsonMap? $set, JsonMap? $unset, JsonMap? $inc, JsonMap? $push, JsonMap? $pull, JsonMap? $addToSet, JsonMap? $rename, JsonMap? additionalUpdate, bool optimistic = false}) → Future<void>
Performs an update on this document using MongoDB update operators. The update will be applied atomically on the server. If optimistic is true, the cache will be updated immediately with the expected changes, and then reconciled with the server response when it arrives. If optimistic is false, the cache will only be updated when the server confirms the update. The update parameter should be a map containing MongoDB update operators like $set, $unset, $inc, $push, $pull, $addToSet, and $rename. Updates this document with MongoDB update operators.

Operators

operator ==(Object other) → bool
The equality operator.
inherited