Module: Mongoid::Selectable

Extended by:
ActiveSupport::Concern
Included in:
Composable, Criteria::Queryable
Defined in:
lib/mongoid/selectable.rb

Overview

Provides behavior for generating the selector for a specific document.

Instance Method Summary collapse

Instance Method Details

#atomic_selectorHash

Get the atomic selector for the document. This is a hash in the simplest case { “_id” => id }, but can become more complex for embedded documents and documents that use a shard key.

Examples:

Get the document’s atomic selector.

document.atomic_selector

Returns:

  • (Hash)

    The document’s selector.



18
19
20
# File 'lib/mongoid/selectable.rb', line 18

def atomic_selector
  embedded? ? embedded_atomic_selector : root_atomic_selector_in_db
end