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

find_or_create_by fails with dynamic collection

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 6.0.0
    • None

    Description

      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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: