Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5226

Allow setting "store_in collection" on document subclass

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 8.1.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible

      This code raises an InvalidStorageParent error.

      class Animal
        include Mongoid::Document
      
        store_in collection: 'animals'
      end
      
      class Dog < Animal
         include Mongoid::Document
      
         store_in collection: 'dogs'  #=> raises InvalidStorageParent 
      end

      Is there any reason we have this restriction? It would be very useful to subclass a document and make it stored in a different collection.

            Assignee:
            neil.shweky@mongodb.com Neil Shweky (Inactive)
            Reporter:
            shields@tablecheck.com Johnny Shields
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: