-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
for example, having this class:
class MyDocument
include Mongoid::Document
field :one_field, type: String
field :another_field, type: String
index(
{one_field: 1, another_field: 1})
index(
)
end
will only create one index, this is because index_options is a hash that uses index() first parameter as key, so the second call to index() would update the same object.
this is fixable by doing
class MyDocument
include Mongoid::Document
field :one_field, type: String
field :another_field, type: String
index_options.compare_by_identity
index(
)
index(
)
end
that makes the index_option hash recognize both keys as different, maybe this should be enabled by default?