Looking at the MongoDB documentation it looks like you can ensure an index is created for a collection at application runtime using a command that looks something like this:
db.myCollection.ensureIndex({'my-col': 1}, {unique: true})
I can't find anything like this in the reactive mongo apis. Does such a thing exist?
You can access the IndexManager from your BSONCollection:
collection.indexesManager.ensure(...)
See reactivemongo docs for details:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With