diff --git a/MongoDB.Entities/Commands/Watcher.cs b/MongoDB.Entities/Commands/Watcher.cs index 59ea14edf..012d86e15 100644 --- a/MongoDB.Entities/Commands/Watcher.cs +++ b/MongoDB.Entities/Commands/Watcher.cs @@ -46,7 +46,7 @@ public class Watcher where T : IEntity /// /// The last resume token received from mongodb server. Can be used to resume watching with .StartWithToken() method. /// - public BsonDocument ResumeToken => options?.ResumeAfter; + public BsonDocument ResumeToken => options?.StartAfter; private PipelineDefinition, ChangeStreamDocument> pipeline; private ChangeStreamOptions options; @@ -63,7 +63,7 @@ public class Watcher where T : IEntity /// x => x.FullDocument.Prop1 == "SomeValue" /// The max number of entities to receive for a single event occurence /// Set to true if you don't want the complete entity details. All properties except the ID will then be null. - /// Set to false if you'd like to skip the changes that happened while the watching was stopped + /// Set to false if you'd like to skip the changes that happened while the watching was stopped. This will also make you unable to retrieve a ResumeToken. /// A cancellation token for ending the watching/change stream public void Start( EventType eventTypes, @@ -138,8 +138,12 @@ private void Init( PipelineStageDefinitionBuilder.Match(filters), - PipelineStageDefinitionBuilder.Project,ChangeStreamDocument>( - $"{{ _id: 1, operationType: 1 , fullDocument: {(onlyGetIDs ? "'$documentKey'" : "1")} }}") + PipelineStageDefinitionBuilder.Project,ChangeStreamDocument>(@" + { + _id: 1, + operationType: 1, + fullDocument: { $ifNull: ['$fullDocument', '$documentKey'] } + }") }; options = new ChangeStreamOptions diff --git a/MongoDB.Entities/MongoDB.Entities.csproj b/MongoDB.Entities/MongoDB.Entities.csproj index 9b8a5373b..482063c0e 100644 --- a/MongoDB.Entities/MongoDB.Entities.csproj +++ b/MongoDB.Entities/MongoDB.Entities.csproj @@ -8,14 +8,12 @@ A data access library for MongoDB with an elegant api, LINQ support and built-in entity relationship management. LICENSE https://github.com/dj-nitehawk/MongoDB.Entities - 13.6 - 13.6.0.0 - 13.6.0.0 + 13.6.1 + 13.6.1.0 + 13.6.1.0 Đĵ ΝιΓΞΗΛψΚ - - simplified change-stream api -- ability to resume change-streams with tokens -- ability to filter insert & update events with an expression -- misc. code changes + - fix bug with change-stream watcher not setting resume token correctly +- improve change-stream watcher internal pipeline MongoDB.Entities MongoDB.Entities diff --git a/README.md b/README.md index 3b0596132..07cb9004b 100644 --- a/README.md +++ b/README.md @@ -16,11 +16,11 @@ This library simplifies access to mongodb by abstracting away the C# mongodb dri - Programatically define indexes. - Full text search (including fuzzy matching) with text indexes. - Multi-document transaction support. +- Multiple database support. - Easy bulk operations. -- Update with aggregation pipeline stages & array filters. -- Easy GeoSpatial search. +- Change-stream support. +- GeoSpatial search. - Stream files in chunks to and from mongodb (GridFS alternative). -- Multiple database support. - Project types supported: .Net Standard 2.0 (.Net Core 2.0 & .Net Framework 4.6.1 or higher)