Closed dpavicic closed 11 months ago
I would refactor the existing CollectionConfigurator and make a async factory method, where you can change the settings AND add new indexes.
Yep, that would be a better solution, but I didn't want to break compatibility with the existing API.
I see the CollectionConfigurator is just an Action passing regular MongoCollectionSettings of the driver.
public Action<MongoCollectionSettings> CollectionConfigurator { get; set; }
If this is changed, it would be a breaking change for a certain amount of people.
Or did you mean to expand the Action with additional parameters to include, for example, something like Func<IMongoCollection<BsonDocument>, Task>
Can you please describe more about what you have in mind? Maybe I can help.
This minor feature enhancement introduces an additional Action in the
MongoDBGrainStorageOptions
, which invokes the delegate in theMongoGrainStorageCollection
'sSetupCollection
method.This change facilitates additional configuration of MongoDB collections during the storage setup process. I've provided an exact example of this feature's application in the updated README (an example of how to add extra indexes). Check it out at: ### Configuring a MongoDB Collection section.
In my personal testing, I found this feature extremely useful as it promotes a hybrid approach. It enables us to leverage the strengths of Orleans while also allowing traditional queries over the grain collections in scenarios where Orleans may not be sufficient.
Cheers, DInko