diff --git a/lib/mongo_dart.dart b/lib/mongo_dart.dart index 0c3fbc13..4e67c85c 100644 --- a/lib/mongo_dart.dart +++ b/lib/mongo_dart.dart @@ -69,6 +69,7 @@ import 'src/database/commands/administration_commands/list_collections_command/l import 'src/database/commands/administration_commands/list_collections_command/list_collections_options.dart'; import 'src/database/commands/administration_commands/listt_indexes_command/list_indexes_command.dart'; import 'src/database/commands/administration_commands/listt_indexes_command/list_indexes_options.dart'; +import 'src/database/commands/aggregation_commands/aggregate/return_classes/change_event.dart'; import 'src/database/commands/aggregation_commands/count/count_operation.dart'; import 'src/database/commands/aggregation_commands/count/count_options.dart'; import 'src/database/commands/aggregation_commands/count/count_result.dart'; diff --git a/lib/src/database/commands/aggregation_commands/aggregate/return_classes/change_event.dart b/lib/src/database/commands/aggregation_commands/aggregate/return_classes/change_event.dart index ff1a05d6..d091751c 100644 --- a/lib/src/database/commands/aggregation_commands/aggregate/return_classes/change_event.dart +++ b/lib/src/database/commands/aggregation_commands/aggregate/return_classes/change_event.dart @@ -48,6 +48,13 @@ class ChangeEvent { /// the original update operation and the full document lookup. Map? fullDocument; + /// The document key of the document created or modified by the insert, + /// replace, delete, update operations (i.e. CRUD operations). + /// + /// This is useful in case of a delete operation and avoid to parse + /// serverResponse documentKey object directly. + Map? documentKey; + /// The namespace (database and or collection) affected by the event. MongoDBNamespace? ns; @@ -67,6 +74,7 @@ class ChangeEvent { } operationType = streamData[keyOperationType] as String?; fullDocument = streamData[keyFullDocument] as Map?; + documentKey = streamData[keyDocumentKey] as Map?; if (streamData[keyNs] != null) { ns = MongoDBNamespace.fromMap( {...streamData[keyNs] as Map}); diff --git a/lib/src/database/dbcollection.dart b/lib/src/database/dbcollection.dart index f5419a08..976d745a 100644 --- a/lib/src/database/dbcollection.dart +++ b/lib/src/database/dbcollection.dart @@ -871,7 +871,7 @@ class DbCollection { rawOptions: rawOptions)); } - Stream watch(Object pipeline, + Stream watch(Object pipeline, {int? batchSize, String? hint, Map? hintDocument, diff --git a/lib/src/database/utils/map_keys.dart b/lib/src/database/utils/map_keys.dart index 9228b243..f6682d40 100644 --- a/lib/src/database/utils/map_keys.dart +++ b/lib/src/database/utils/map_keys.dart @@ -75,6 +75,7 @@ const keyDeletes = 'deletes'; const keyDeleteArgument = 'deletes'; const keyDistinct = 'distinct'; const keyDocuments = 'documents'; +const keyDocumentKey = 'documentKey'; const keyDrop = 'drop'; const keyDropDatabase = 'dropDatabase'; const keyDropDuplicatedEntries = 'dropDups';