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

Add Factory#from_map_or_db for identity map use on criteria based queries

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

      This pull request adds Factory.from_map_or_db, which will load previously instantiated documents from the identity map before instantiating a new document for a given id. In addition, this pull request changes criteria-based queries and relations to use this new method instead of Factory.from_db. This allows for statements like this to be true:

      Person.find("1").object_id == Person.where(id:"1").first.object_id
      

      This change makes the IdentityMap semantics less complicated, IMO.

            Assignee:
            Unassigned Unassigned
            Reporter:
            nullstyle nullstyle
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: