Module: Mongoid::Contextual
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Classes:
| |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Forwardable
|
|
Defined in: | lib/mongoid/contextual.rb, lib/mongoid/contextual/aggregable.rb, lib/mongoid/contextual/atomic.rb, lib/mongoid/contextual/command.rb, lib/mongoid/contextual/map_reduce.rb, lib/mongoid/contextual/memory.rb, lib/mongoid/contextual/mongo.rb, lib/mongoid/contextual/none.rb, lib/mongoid/contextual/queryable.rb, lib/mongoid/contextual/aggregable/memory.rb, lib/mongoid/contextual/aggregable/mongo.rb, lib/mongoid/contextual/aggregable/none.rb, lib/mongoid/contextual/mongo/documents_loader.rb |
Overview
Parent mixin module which adds aggregation (#sum, #avg, etc.) and atomic (#set, #unset, #push, etc.) behavior to Criteria
.
Instance Method Summary
-
#context ⇒ Memory | Mongo
Get the context in which criteria queries should execute.
-
#load_async ⇒ Criteria
Instructs the context to schedule an asynchronous loading of documents specified by the criteria.
-
#create_context ⇒ Mongo | Memory
private
Internal use only
Internal use only
Create the context for the queries to execute.
Instance Method Details
#context ⇒ Memory | Mongo
Get the context in which criteria queries should execute. This is either in memory (for embedded documents) or mongo (for root level documents.)
# File 'lib/mongoid/contextual.rb', line 38
def context @context ||= create_context end
#create_context ⇒ Mongo | Memory (private)
Create the context for the queries to execute. Will be memory for embedded documents and mongo for root documents.
#load_async ⇒ Criteria
Instructs the context to schedule an asynchronous loading of documents specified by the criteria.
Note that depending on the context and on the ::Mongoid
configuration, documents can be loaded synchronously on the caller’s thread.