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
Due to using strings instead of properties in a BsonDocument filter, compatibility with the CamelCaseElementNameConvention is lost.
Since I rely on camel casing for all other MongoDb actions (conventions applied globally), the only way I'm able to get around this currently is applying a custom class map for each SagaData implementation, which is obviously not ideal :(
var criteria = Builders<BsonDocument>.Filter.And(
Builders<BsonDocument>.Filter.Eq("_id", sagaData.Id),
Builders<BsonDocument>.Filter.Eq(nameof(ISagaData.Revision), sagaData.Revision)
);
Using Filter.Where instead of Filter.Eq would get around this, but I think you'd need to be strongly typed instead of using BsonDocument in order to do that.
This would also be an issue in the BSON validation:
Sorry @ctcoulter , but due to the design of MongoDB's BSON serializer, it's not possibly for Rebus to support all customizations – that's why it does a check on a dummy-serialized empty saga instance to see, if the expected fields can be found in the resulting BSON document.
But.... thingking of it now, I think it could be possible for Rebus' MongoDB saga persister to figure out the exact BSON field names by doing a dummy serialization (like it already does) and then remember the names of the resulting fields with the correct casing.
If you're interested in contributing this, please feel free to send a PR 🙂
Due to using strings instead of properties in a BsonDocument filter, compatibility with the CamelCaseElementNameConvention is lost.
Since I rely on camel casing for all other MongoDb actions (conventions applied globally), the only way I'm able to get around this currently is applying a custom class map for each SagaData implementation, which is obviously not ideal :(
Example:
https://github.com/rebus-org/Rebus.MongoDb/blob/master/Rebus.MongoDb/MongoDb/Sagas/MongoDbSagaStorage.cs#L103
Using
Filter.Where
instead ofFilter.Eq
would get around this, but I think you'd need to be strongly typed instead of using BsonDocument in order to do that.This would also be an issue in the BSON validation:
https://github.com/rebus-org/Rebus.MongoDb/blob/master/Rebus.MongoDb/MongoDb/Sagas/MongoDbSagaStorage.cs#L247-L250
^ this one might be fixed just by doing something like this instead.
The text was updated successfully, but these errors were encountered: