Sha256: d1bb8361d9b97c922b0828e6c5d0d73d3db1313e90481c7c414bea1aa5d913c0

Contents?: true

Size: 880 Bytes

Versions: 5

Compression:

Stored size: 880 Bytes

Contents

# encoding: utf-8
module Mongoid
  module Contextual
    module Command
      extend Gem::Deprecate

      # @attribute [r] collection The collection to query against.
      # @attribute [r] criteria The criteria for the context.
      attr_reader :collection, :criteria

      # The database command that is being built to send to the db.
      #
      # @example Get the command.
      #   command.command
      #
      # @return [ Hash ] The db command.
      #
      # @since 3.0.0
      def command
        @command ||= {}
      end

      # Get the database client.
      #
      # @example Get the client.
      #   command.client
      #
      # @return [ Mongo::Client ] The Mongo client.
      #
      # @since 3.0.0
      def client
        collection.database.client
      end
      alias :session :client
      deprecate :session, :client, 2015, 12
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/mongoid-5.0.1/lib/mongoid/contextual/command.rb
mongoid-5.0.1 lib/mongoid/contextual/command.rb
mongoid-5.0.0 lib/mongoid/contextual/command.rb
mongoid-5.0.0.rc0 lib/mongoid/contextual/command.rb
mongoid-5.0.0.beta lib/mongoid/contextual/command.rb