-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sparse option breaks db:mongoid:create_indexes on existing collections #160
Comments
Maybe it should be configurable? |
Is it possible for you to recreate the index? The reason for the change in the index is described here: #155. |
Any updates on this issue? I would like to make sure we have reasonable migration paths from one version to another, and this was an unfortunate mistake in our previous indexing scheme. |
No, I just pinned mongoid-slug to the old version. Recreating all indexes is not really an option for a large dataset with many collections, since in practice it should be done manually, and since indexes already exist for me, all my records already have slugs so I don't need sparse. |
But yes, I completely agree that for new projects sparse index is a good idea, that's why I think it should be configurable and default to false in current patch version and to true in next minor/major version, if done according to semantic versioning. |
@glebtv I think you are referring to |
Ignore the above, I see the issue here. |
Since I'm not sure how anyone can use this gem and have a working setup. Has there been a change in the uniqueness handling in new mongodb versions, did it use to accept multiple documents having empty arrays? We're using the gem from scratch on a new app so we have no legacy data to worry about. |
Encounters the same problem as @dbackeus . Steps to reproduce: class Article
include Mongoid::Document
include Mongoid::Slug
include Mongoid::Paranoia
field :url_seg, type: String
slug :url_seg
end
Article.create_indexes
Article.create
Article.create
# => E11000 duplicate key error index Find out a ticket on mongoDB's site: https://jira.mongodb.org/browse/SERVER-3934 |
Bump @manxingxing @glebtv What do we want to do about this? |
@glebtv all you need to do is drop the index which is affected, then recreate specifically that index. (You can do this for a single index without affecting all other indexes.) |
Alternatively, you could do the following steps without affecting production:
|
I think a suitable workaround would be to have an |
"Index with name: _slugs_1 already exists with different options"
The text was updated successfully, but these errors were encountered: