Get the context in which criteria queries should execute. This is either in memory (for embedded documents) or mongo (for root level documents.)
@example Get the context.
criteria.context
@return [ Memory, Mongo ] The context.
@since 3.0.0
# File lib/mongoid/contextual.rb, line 29 def context @context ||= create_context end
Create the context for the queries to execute. Will be memory for embedded documents and mongo for root documents.
@api private
@example Create the context.
contextual.create_context
@return [ Mongo, Memory ] The context.
@since 3.0.0
# File lib/mongoid/contextual.rb, line 46 def create_context embedded ? Memory.new(self) : Mongo.new(self) end