Class: Moped::Protocol::Delete
- Inherits:
-
Object
- Object
- Moped::Protocol::Delete
- Includes:
- Message
- Defined in:
- lib/moped/protocol/delete.rb
Overview
The Protocol class for deleting documents from a collection.
Instance Attribute Summary collapse
-
#collection ⇒ String, Symbol
readonly
The collection to delete from.
-
#database ⇒ String, Symbol
readonly
The database to delete from.
-
#flags ⇒ Array
The flags for the message.
-
#full_collection_name ⇒ String
The full collection name.
-
#length ⇒ Number
The length of the message.
-
#op_code ⇒ Number
OP_DELETE operation code (2006).
-
#request_id ⇒ Number
The request id of the message.
-
#selector ⇒ Hash
The query to use when deleting documents.
Instance Method Summary collapse
-
#initialize(database, collection, selector, options = {}) ⇒ Delete
constructor
Create a new delete command.
- #log_inspect ⇒ Object
Methods included from Message
included, #inspect, #receive_replies, #serialize
Constructor Details
#initialize(database, collection, selector, options = {}) ⇒ Delete
Create a new delete command. The database
and collection
arguments are joined together to set the full_collection_name
.
71 72 73 74 75 76 77 78 79 |
# File 'lib/moped/protocol/delete.rb', line 71 def initialize(database, collection, selector, = {}) @database = database @collection = collection @full_collection_name = "#{database}.#{collection}" @selector = selector @request_id = [:request_id] @flags = [:flags] end |
Instance Attribute Details
#collection ⇒ String, Symbol (readonly)
Returns the collection to delete from.
54 55 56 |
# File 'lib/moped/protocol/delete.rb', line 54 def collection @collection end |
#database ⇒ String, Symbol (readonly)
Returns the database to delete from.
51 52 53 |
# File 'lib/moped/protocol/delete.rb', line 51 def database @database end |
#flags ⇒ Array
Returns the flags for the message.
42 |
# File 'lib/moped/protocol/delete.rb', line 42 flags :flags, remove_first: 2 ** 0 |
#full_collection_name ⇒ String
Returns the full collection name.
37 |
# File 'lib/moped/protocol/delete.rb', line 37 cstring :full_collection_name |
#length ⇒ Number
Returns the length of the message.
21 |
# File 'lib/moped/protocol/delete.rb', line 21 int32 :length |
#op_code ⇒ Number
Returns OP_DELETE operation code (2006).
31 |
# File 'lib/moped/protocol/delete.rb', line 31 int32 :op_code |
#request_id ⇒ Number
Returns the request id of the message.
25 |
# File 'lib/moped/protocol/delete.rb', line 25 int32 :request_id |
#selector ⇒ Hash
Returns the query to use when deleting documents.
46 |
# File 'lib/moped/protocol/delete.rb', line 46 document :selector |
Instance Method Details
#log_inspect ⇒ Object
87 88 89 90 91 |
# File 'lib/moped/protocol/delete.rb', line 87 def log_inspect type = "DELETE" "%-12s database=%s collection=%s selector=%s flags=%s" % [type, database, collection, selector.inspect, flags.inspect] end |