Parent

Methods

Class/Module Index [+]

Quicksearch

Mongoid::Atomic::Paths::Root

This class encapsulates behaviour for locating and updating root documents atomically.

Attributes

document[R]
path[R]
position[R]

Public Instance Methods

selector() click to toggle source

Get the selector to use for the root document when performing atomic updates. When sharding this will include the shard key.

@example Get the selector.

root.selector

@return [ Hash ] The selector to identify the document with.

@since 2.1.0

# File lib/mongoid/atomic/paths/root.rb, line 32
def selector
  { "_id" => document.identifier || document._id }.
    merge!(document.shard_key_selector)
end

Public Class Methods

new(document) click to toggle source

Create the new root path utility.

@example Create the root path util.

Root.new(document)

@param [ Document ] document The document to generate the paths for.

@since 2.1.0

# File lib/mongoid/atomic/paths/root.rb, line 19
def initialize(document)
  @document, @path, @position = document, "", ""
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.