Closed danielfishr closed 5 years ago
Hi, NEventStore V5.x used the 1.x version of the MongoDB Drivers, the way things were registered were different at the time. With the new COnvention Packs if extremely easy to override any registration made by the library itsels.
Thus when definig your Conventions it's not recommended to 'touch' the classes the NEventStore driver uses to persist its own data.
My recommendation, when registering your convention, is always to specify the namespaces to which those settings applies.
I double checked the old code, and the BsonDocument was constructed "by hand" in NEventStore v5.x. In V6 we introduced a new MongoCommit class so we could better customize some aspects of the mapping.
I've created a Test and decorated the MongoCommit with BsonElement attribute that specify the correct field names for each property.
I've spotted two related issues.
Persisted field names in the Commit collection respect registered MongoDB conventions, however the field names in the Commit collection's indexes do not.
I think the cause of this is when creating indexes you have the field names hard coded as the TitleCase strings specified by
MongoCommitFields
If a camelCase convention pack is registered like so.
The app will be in a broken state as the indexes mismatch with the persisted field names.
The second issue to be aware of this that the handling of the camelCase convention is a breaking change with version 5 of NEventStore. Version 5 would persist the fields outside of the payload in TitleCase and fields within the payload as camelCase like so.
Is this a known an intended breaking change?