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

default value of belongs_to_required_by_default causes performance issues

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 8.0.1, 8.1.0
    • Component/s: Performance, Validations
    • Labels:
      None

      Hi there, thanks for all your work on Mongoid!

       

      We are currently using Mongoid 7.5.3 and we want to upgrade to Mongoid 8.1.1. Everything seems to be working fine except that the performance when creating document has degraded a bit. I've been trying to find the specific commit that was causing this issue and I found out that this commit introduced the performance issues:

      https://github.com/mongodb/mongoid/commit/13044a829141495b39ff4c62adef1ac7299e7e4a

      Removing the following change fixes the performance issues

      https://github.com/mongodb/mongoid/commit/13044a829141495b39ff4c62adef1ac7299e7e4a#diff-99ee661efb30cc0bfc0d3789a9da3de357a134c83ba153e871840720f2e6559bR156

      The other way of fixing the issue is by setting belongs_to_required_by_default to false in the mongoid.yml file but it would be great if we can have the validations while having the performance of mongoid 7.5.3.

      Thanks in advance for your help and keep up the good work!

       

        1. 5635-with-change.txt
          3 kB
        2. 5635-without-change.txt
          3 kB

            Assignee:
            dmitry.rybakov@mongodb.com Dmitry Rybakov
            Reporter:
            diego@countit.com Diego del Valle
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: