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

find_or_create_by fails with dynamic collection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.0.0
    • Component/s: None
    • Labels:

      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

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

              Dates

              Created:
              Updated:
              Resolved: