This section is relevant only if you are using Mongoid 3.
IdentityMap has been removed in Mongoid 4 because it now includes
IdentityMap pattern is a design pattern where the object gets loaded only once from the database, and is then stored in the map. So, the next lookup is directly from the map and hence faster. The
IdentityMap pattern has been implemented in Mongoid (and removed in the latest version).
Ignore the rest of this section if you use Mongoid4. Only if you are using Mongoid 3, is the remaining section relevant.
If enabled properly,
IdentityMap can greatly improve the performance of queries. Whenever a document is loaded from the database, it is classified by class and ID kept in the