You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -224,6 +224,18 @@ public class PersonDocument : IMongoDocument
224
224
}
225
225
```
226
226
227
+
For multiple clusters setup, you can specify which named client owns the collection using `ClientName`. This will have the following effect:
228
+
* The injection of `IMongoCollection<TDocument>` will resolve the collection from the named client instead of the default client
229
+
* The index creation from `UpdateIndexesAsync` will route each document type to its declared cluster automatically when scanning an assembly (no need to call `UpdateIndexesAsync` once per client)
In certain scenarios, like in Domain Driven Design (DDD), one would like to persist their Domain Aggregates as is in the Document Database. These Domain objects are not aware of how they are persisted. They cannot be decorated with Persistence level attributes (ie `[MongoCollection()]`), nor can they implement `IMongoDocument`.
thrownewArgumentException(documentType+" must be decorated with "+nameof(MongoCollectionAttribute)+" or be registered by a "+typeof(IMongoCollectionConfiguration<>).MakeGenericType(documentType).Name);
0 commit comments