-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.3.0
-
Component/s: None
-
None
-
Environment:mongo-2.3.0
The issue is known to happen with 5.1.4 and 5.1.5, but the most important factor is using mongo ruby driver 2.3.0.
As seen in the documentation :
"You can define indexes on embedded document fields as well."
https://docs.mongodb.com/ruby-driver/master/tutorials/5.1.0/mongoid-indexes/
This does not work anymore.
You can easily break the RSpec suite by adding the following line to spec/app/models/person.rb :
index "addresses.street" => 1
The RSpec suite will then fail at multiple places, throwing BSON::String::IllegalKey exceptions :
Failure/Error: collection.indexes.create_one(key, options)
BSON::String::IllegalKey:
'addresses.street' is an illegal key in MongoDB. Keys may not start with '$' or contain a '.'
You can also trigger the bug by executing the create_indexes rake task.
The only workaround is to use mongo driver < 2.3.0.
- duplicates
-
RUBY-1163 Could not create index for embedded documents
- Closed