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

Don't execute update command when concatenating empty array

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

      Current implementation of Mongoid::Relations::Embedded::Many#concat will always run #batch_insert, even if the supplied docs array is empty. This could have a small performance impact on code relying on #concat but can also lead to an issue in Batchable#path where #atomic_path will be sent to nil.

      This also brings the approach of #concat closer to the implementation of #<< where an empty list of arguments will leave the target untouched.

            Assignee:
            Unassigned Unassigned
            Reporter:
            lackac László Bácsi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: