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
Hi James (and any others who might be able to assist).
I've been using MongoFramework for sometime now on my current project and its brilliant. However I have run into a problem.
I am going to be honest, I am not sure if this is an issue or me doing something dumb.
I recently needed to add some text indexes to properties on an entity, in order to use the SearchText method. I tried adding the indexes using the Attribute decorator, as well as via the MongoDbContext in the OnConfiguringMapping method. Neither instance seemed to result in the indexes being created in my DB when the project was run.
I tried calling context.SaveChangesAsync() just in case that was required but to no avail. If I go to the DB and create the indexes manually, the SearchText method works fine. If I just allow MongoFramework to do its thing, it throws the below error.
MongoDB.Driver.MongoCommandException: Command aggregate failed: text index required for $text query.
Hopefully this is just me missing something in the doco and not an actual issue, as it seems pretty fundamental. Any assistance would be much appreciated.
Thanks for raising the issue @wlewis22 - it is a strange one. What version of MongoDB are you using?
I tried calling context.SaveChangesAsync() just in case that was required but to no avail.
Yeah, a call to SaveChanges / SaveChangesAsync is required as we're doing an IO operation and we don't know what types you want to apply indexing to until the last minute.
There is a test that does confirm the index creation behaviour for text indexes (EntityIndexWriterTests.WriteIndexAsync) and running that locally still passes so I don't know what you're hitting.
Hi James (and any others who might be able to assist).
I've been using MongoFramework for sometime now on my current project and its brilliant. However I have run into a problem.
I am going to be honest, I am not sure if this is an issue or me doing something dumb.
I recently needed to add some text indexes to properties on an entity, in order to use the SearchText method. I tried adding the indexes using the Attribute decorator, as well as via the MongoDbContext in the OnConfiguringMapping method. Neither instance seemed to result in the indexes being created in my DB when the project was run.
I tried calling context.SaveChangesAsync() just in case that was required but to no avail. If I go to the DB and create the indexes manually, the SearchText method works fine. If I just allow MongoFramework to do its thing, it throws the below error.
MongoDB.Driver.MongoCommandException: Command aggregate failed: text index required for $text query.
Hopefully this is just me missing something in the doco and not an actual issue, as it seems pretty fundamental. Any assistance would be much appreciated.
Below is my DB Context, in case that helps.
The text was updated successfully, but these errors were encountered: