Class: Mongo::WriteConcern::Acknowledged

Inherits:
Object
  • Object
show all
Includes:
Normalizable
Defined in:
lib/mongo/write_concern/acknowledged.rb

Overview

An acknowledged write concern provides a get last error command with the appropriate options on each write operation.

Since:

  • 2.0.0

Instance Attribute Summary

Attributes included from Normalizable

#options

Instance Method Summary collapse

Methods included from Normalizable

#initialize

Instance Method Details

#get_last_errorHash

Get the get last error command for the concern.

Examples:

Get the gle command.

acknowledged.get_last_error

Returns:

  • (Hash)

    The gle command.

Since:

  • 2.0.0



33
34
35
36
37
# File 'lib/mongo/write_concern/acknowledged.rb', line 33

def get_last_error
  @get_last_error ||= { GET_LAST_ERROR => 1 }.merge(
    Options::Mapper.transform_values_to_strings(options)
  )
end

#inspectString

Get a human-readable string representation of an acknowledged write concern.

Examples:

Inspect the write concern.

write_concern.inspect

Returns:

  • (String)

    A string representation of an acknowledged write concern.

Since:

  • 2.0.0



47
48
49
# File 'lib/mongo/write_concern/acknowledged.rb', line 47

def inspect
  "#<Mongo::WriteConcern::Acknowledged:0x#{object_id} options=#{options}>"
end