-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
When using the shard_key directive in a mongoid document class, the fields are not interpreted with respect to relationships. If you have a
:belongs_to :foo
, for example, and try to
:shard_key :foo
, you'll receive a "missing type" exception when you try to destroy an object of this class.
The workaround is to use
:shard_key :foo_id
.
Note that this works correctly for indexes;
Unable to find source-code formatter for language: index. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
( { foo: 1 } )
will correctly index against :foo_id.