MongoDB.Entities.ReactiveChangeStream
1.0.2
dotnet add package MongoDB.Entities.ReactiveChangeStream --version 1.0.2
NuGet\Install-Package MongoDB.Entities.ReactiveChangeStream -Version 1.0.2
<PackageReference Include="MongoDB.Entities.ReactiveChangeStream" Version="1.0.2" />
paket add MongoDB.Entities.ReactiveChangeStream --version 1.0.2
#r "nuget: MongoDB.Entities.ReactiveChangeStream, 1.0.2"
// Install MongoDB.Entities.ReactiveChangeStream as a Cake Addin #addin nuget:?package=MongoDB.Entities.ReactiveChangeStream&version=1.0.2 // Install MongoDB.Entities.ReactiveChangeStream as a Cake Tool #tool nuget:?package=MongoDB.Entities.ReactiveChangeStream&version=1.0.2
MongoDB.Entities.ReactiveChangeStream
Extension for MongoDB Entities Library to handle MongoDB Change Streams as an IObservale
MongoDB Change Streams are a feature that allow the database to notify subscribers for any change, more about Change Streams
For MongoDB Official C# Driver use MongoDB.ReactiveChangeStream
MongoDB.Entities
A light-weight .net standard library with barely any overhead that aims to simplify access to mongodb by abstracting the official driver while adding useful features on top of it resulting in an elegant API surface which produces beautiful, human friendly data access code.
Installation
First, install the MongoDB.Entities.ReactiveChangeStream
Nuget package into your app
Install-Package MongoDB.Entities.ReactiveChangeStream
Example Usage
Create Reactive Change Stream directly:
using System.Reactive.Linq;
using MongoDB.Driver;
using MongoDB.Entities;
await DB.InitAsync("foo",
MongoClientSettings.FromConnectionString("mongodb://localhost:27017/foo?replicaSet=rs0"));
var changeObservable = DBEx.StartReactiveWatcher<Entity>();
changeObservable
.Buffer(TimeSpan.FromSeconds(5))
.Do(changes =>
{
// Do something
})
.Subscribe();
From a Watcher instance:
using System.Reactive.Linq;
using MongoDB.Driver;
using MongoDB.Entities;
await DB.InitAsync("foo",
MongoClientSettings.FromConnectionString("mongodb://localhost:27017/foo?replicaSet=rs0"));
var watcher = DB.Watcher<Entity>("watcher");
watcher.Start(EventType.Created | EventType.Deleted | EventType.Updated);
watcher
.ToObservableChangeStream();
.Buffer(TimeSpan.FromSeconds(5))
.Do(changes =>
{
// Do something
})
.Subscribe();
Watch individual Entities changes filtered by their IDs:
using System.Reactive.Linq;
using MongoDB.Driver;
using MongoDB.Entities;
using MongoDB.Entities.ReactiveChangeStream;
var foo = DB.Entity<Foo>();
foo
.ObserveChanges()
.Buffer(TimeSpan.FromSeconds(5))
.Do(changes =>
{
// Do something
})
.Subscribe();
class Foo : Entity
{
/*
*/
}
Note:
Make sure you connecting to a MongoDB instance with Replica Set Enabled, as Change Streams require it. read more about how to initialize a Replica Set here...
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- MongoDB.Entities (>= 20.26.3)
- System.Reactive (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.