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

Unique Sparse indexes and create

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.1.4
    • Affects Version/s: None
    • Component/s: None
    • None

      It appears that the create method will send a null on create for fields that weren't defined in the create statement, this will cause the unique constraint to trigger (since null is included in sparse).

      This was driving me nuts since I couldn't replicate it at the command line. Could this be changed so that a create will only send the field for inserting if there's a default defined for it? Or have I completely missed something?

            Assignee:
            arthurnn Arthur Nogueira Neves
            Reporter:
            gshiftlabs-dbuttineau gshiftlabs-dbuttineau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: