watch method

Stream watch({
  1. List<String>? ids,
  2. bool asObjectIds = true,
})

Watches a collection. The resulting stream will be notified of all events on this collection that the active user is authorized to see based on the configured MongoDB rules. can optionally watch only specifies documents with the provided ids

Implementation

Stream watch({List<String>? ids, bool asObjectIds = true}) {
  var stream;
  if (kIsWeb) {
    FlutterMongoRealm.setupWatchCollection(collectionName, databaseName,
        ids: ids, asObjectIds: asObjectIds);

    stream = FlutterMongoRealm.watchCollection(
      collectionName: this.collectionName,
      databaseName: this.databaseName,
    );
  } else {
    stream = FlutterMongoRealm.watchCollection(
      collectionName: this.collectionName,
      databaseName: this.databaseName,
      ids: ids,
      asObjectIds: asObjectIds,
    );
  }

  return stream;
}