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

find_or_create_by fails with dynamic collection

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.0
    • Affects Version/s: None
    • Component/s: None

      class OneModel
      include Mongoid::Document

      field :a
      end

      class AnotherModel
      include Mongoid::Document

      field :a
      end

      OneModel.with(collection: 'another_models').find_or_create_by(:a => 1)

      OneModel.count => 1
      AnotherModel.count => 0

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            makeshifthoop makeshifthoop
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: