Skip to content

Instantly share code, notes, and snippets.

@jb08
Last active March 22, 2024 23:45
Show Gist options
  • Save jb08/d0439c70976d1dd1df3a587e6736b30d to your computer and use it in GitHub Desktop.
Save jb08/d0439c70976d1dd1df3a587e6736b30d to your computer and use it in GitHub Desktop.
Mongoid subclass indicies not created in Atlas
class Animal
field :color, type: String
field :mammal, type: Boolean
...
index({ mammal: 1, color: 1 }, background: true)
end
class Bear < Animal
include Mongoid::Document
field :hibernates, type: Boolean
field :favorite_honey_type, type: String
index({ mammal: 1, favorite_honey_type: 1 }, background: true) ### this index is not showing up in Atlas
### is adding index line in file the "correct" way to add a new index? or via Atlas? or both?
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment