rebus-org / Rebus.MongoDb

:bus: MongoDB persistence implementations for Rebus
https://mookid.dk/category/rebus
Other
5 stars 6 forks source link

Index creation on saga correlation properties breaks my app #7

Closed tresoldigiorgio closed 4 years ago

tresoldigiorgio commented 4 years ago

I've already a code that create an index on correlation properties of a saga. Can you add a check that skip creation if an index with same properties already exists? Now i get this error because my index are created before your and/or already exists. Command createIndexes failed: Index: { v: 2, unique: true, key: { WorkflowId: 1 }, name: "WorkflowId_1", ns: "devops-test-core.WorkflowSagaData" } already exists with different options: { v: 2, key: { WorkflowId: 1 }, name: "A-WorkflowId", background: true, ns: "devops-test-core.WorkflowSagaData" }.

Thanks

mookid8000 commented 4 years ago

Rebus.MongoDb 6.0.5 is out on NuGet.org now.

With it, you can

Configure.With(...)
    .(...)
    .Sagas(s => s.StoreInMongoDb(database, automaticallyCreateIndexes: false))
    .Start();

to skip index creation.

I hope that solves your problem. 🙂