Module: Mongo::Operation::Specifiable Private
- Included in:
- Aggregate, CollectionsInfo, Command, Count, Create, CreateIndex, CreateUser, Delete, Distinct, Drop, DropDatabase, DropIndex, Explain, Find, GetMore, Indexes, Insert, KillCursors, ListCollections, MapReduce, OpMsgBase, ParallelScan, RemoveUser, Update, UpdateUser, UsersInfo, WriteCommand
- Defined in:
- build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
This module contains common functionality for convenience methods getting various values from the spec.
Constant Summary collapse
- DB_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for database name.
:db_name.freeze
- DELETES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for deletes.
:deletes.freeze
- DELETE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for delete.
:delete.freeze
- DOCUMENTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for documents.
:documents.freeze
- COLL_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for collection name.
:coll_name.freeze
- CURSOR_COUNT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for cursor count.
:cursor_count.freeze
- CURSOR_ID =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for cursor id.
:cursor_id.freeze
- INDEX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for an index.
:index.freeze
- INDEXES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for multiple indexes.
:indexes.freeze
- INDEX_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for index names.
:index_name.freeze
- OPERATION_ID =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The operation id constant.
:operation_id.freeze
- OPTIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for options.
:options.freeze
- READ_CONCERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The read concern option.
:read_concern.freeze
- MAX_TIME_MS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The max time ms option.
:max_time_ms.freeze
- SELECTOR =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for a selector.
:selector.freeze
- TO_RETURN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for number to return.
:to_return.freeze
- UPDATES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for updates.
:updates.freeze
- UPDATE =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field for update.
:update.freeze
- USER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field name for a user.
:user.freeze
- USER_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field name for user name.
:user_name.freeze
- WRITE_CONCERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field name for a write concern.
:write_concern.freeze
- READ =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
The field name for the read preference.
:read.freeze
- BYPASS_DOC_VALIDATION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Whether to bypass document level validation.
:bypass_document_validation.freeze
- COLLATION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
A collation to apply to the operation.
:collation.freeze
Instance Attribute Summary collapse
-
#spec ⇒ Hash
readonly
private
Spec The specification for the operation.
Instance Method Summary collapse
-
#==(other) ⇒ true, false
(also: #eql?)
private
Check equality of two specifiable operations.
-
#acknowledged_write? ⇒ Boolean
private
Does the operation have an acknowledged write concern.
- #apply_collation(selector, connection, collation) ⇒ Object private
-
#array_filters(connection) ⇒ Hash | nil
private
The array filters.
-
#bypass_document_validation ⇒ true, false
private
Whether or not to bypass document level validation.
-
#coll_name ⇒ String
private
The name of the collection to which the operation should be sent.
-
#collation ⇒ Hash
private
The collation to apply to the operation.
-
#command(connection) ⇒ Hash
private
The command.
-
#cursor_count ⇒ Integer
private
Get the cursor count from the spec.
-
#cursor_id ⇒ Integer
private
The id of the cursor created on the server.
-
#db_name ⇒ String
private
The name of the database to which the operation should be sent.
-
#delete ⇒ Hash
private
Get the delete document from the specification.
-
#deletes ⇒ Array<BSON::Document>
private
Get the deletes from the specification.
-
#documents ⇒ Array<BSON::Document>
private
The documents to in the specification.
-
#index ⇒ Hash
private
Get the index from the specification.
-
#index_name ⇒ String
private
Get the index name from the spec.
-
#indexes ⇒ Hash
private
Get the indexes from the specification.
-
#initialize(spec) ⇒ Object
private
Create the new specifiable operation.
-
#max_time_ms ⇒ Hash
private
Get the max time ms value from the spec.
-
#namespace ⇒ String
private
The namespace, consisting of the db name and collection name.
-
#operation_id ⇒ Integer
private
Get the operation id for the operation.
-
#options(connection) ⇒ Hash
private
Get the options for executing the operation on a particular connection.
-
#ordered? ⇒ true, false
private
Whether the operation is ordered.
-
#read ⇒ Mongo::ServerSelector
private
The read preference for this operation.
-
#read_concern ⇒ Hash
private
Get the read concern document from the spec.
-
#selector(connection) ⇒ Hash
private
The selector from the specification for execution on a particular connection.
-
#session ⇒ Session
private
The session to use for the operation.
-
#to_return ⇒ Integer
private
The number of documents to request from the server.
-
#txn_num ⇒ Integer
private
The transaction number for the operation.
-
#update ⇒ Hash
private
The update document from the spec.
-
#updates ⇒ Array<BSON::Document>
private
The update documents from the spec.
-
#user ⇒ Auth::User
private
The user for user related operations.
-
#user_name ⇒ String
private
The user name from the specification.
-
#write_concern ⇒ Mongo::WriteConcern
private
The write concern to use for this operation.
Instance Attribute Details
#spec ⇒ Hash (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns spec The specification for the operation.
149 150 151 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 149 def spec @spec end |
Instance Method Details
#==(other) ⇒ true, false Also known as: eql?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Check equality of two specifiable operations.
161 162 163 164 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 161 def ==(other) return false unless other.is_a?(Specifiable) spec == other.spec end |
#acknowledged_write? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Does the operation have an acknowledged write concern.
552 553 554 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 552 def acknowledged_write? write_concern.nil? || write_concern.acknowledged? end |
#apply_collation(selector, connection, collation) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
556 557 558 559 560 561 562 563 564 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 556 def apply_collation(selector, connection, collation) if collation unless connection.features.collation_enabled? raise Error::UnsupportedCollation end selector = selector.merge(collation: collation) end selector end |
#array_filters(connection) ⇒ Hash | nil
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The array filters.
539 540 541 542 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 539 def array_filters(connection) sel = selector(connection) sel[Operation::ARRAY_FILTERS] if sel end |
#bypass_document_validation ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether or not to bypass document level validation.
361 362 363 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 361 def bypass_document_validation spec[BYPASS_DOC_VALIDATION] end |
#coll_name ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The name of the collection to which the operation should be sent.
235 236 237 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 235 def coll_name spec.fetch(COLL_NAME) end |
#collation ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The collation to apply to the operation.
373 374 375 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 373 def collation send(self.class::IDENTIFIER).first[COLLATION] end |
#command(connection) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The command.
527 528 529 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 527 def command(connection) selector(connection) end |
#cursor_count ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the cursor count from the spec.
175 176 177 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 175 def cursor_count spec[CURSOR_COUNT] end |
#cursor_id ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The id of the cursor created on the server.
247 248 249 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 247 def cursor_id spec[CURSOR_ID] end |
#db_name ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The name of the database to which the operation should be sent.
187 188 189 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 187 def db_name spec[DB_NAME] end |
#delete ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the delete document from the specification.
211 212 213 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 211 def delete spec[DELETE] end |
#deletes ⇒ Array<BSON::Document>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the deletes from the specification.
199 200 201 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 199 def deletes spec[DELETES] end |
#documents ⇒ Array<BSON::Document>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The documents to in the specification.
223 224 225 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 223 def documents spec[DOCUMENTS] end |
#index ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the index from the specification.
259 260 261 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 259 def index spec[INDEX] end |
#index_name ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the index name from the spec.
271 272 273 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 271 def index_name spec[INDEX_NAME] end |
#indexes ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the indexes from the specification.
283 284 285 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 283 def indexes spec[INDEXES] end |
#initialize(spec) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create the new specifiable operation.
298 299 300 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 298 def initialize(spec) @spec = spec end |
#max_time_ms ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the max time ms value from the spec.
349 350 351 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 349 def max_time_ms spec[MAX_TIME_MS] end |
#namespace ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The namespace, consisting of the db name and collection name.
494 495 496 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 494 def namespace "#{db_name}.#{coll_name}" end |
#operation_id ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the operation id for the operation. Used for linking operations in monitoring.
311 312 313 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 311 def operation_id spec[OPERATION_ID] end |
#options(connection) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the options for executing the operation on a particular connection.
323 324 325 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 323 def (connection) spec[OPTIONS] || {} end |
#ordered? ⇒ true, false
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Whether the operation is ordered.
482 483 484 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 482 def ordered? !!(@spec.fetch(:ordered, true)) end |
#read ⇒ Mongo::ServerSelector
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The read preference for this operation.
468 469 470 471 472 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 468 def read @read ||= begin ServerSelector.get(spec[READ]) if spec[READ] end end |
#read_concern ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The document may include afterClusterTime.
Get the read concern document from the spec.
337 338 339 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 337 def read_concern spec[READ_CONCERN] end |
#selector(connection) ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The selector from the specification for execution on a particular connection.
386 387 388 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 386 def selector(connection) spec[SELECTOR] end |
#session ⇒ Session
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The session to use for the operation.
506 507 508 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 506 def session @spec[:session] end |
#to_return ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The number of documents to request from the server.
398 399 400 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 398 def to_return spec[TO_RETURN] end |
#txn_num ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The transaction number for the operation.
518 519 520 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 518 def txn_num @spec[:txn_num] end |
#update ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The update document from the spec.
420 421 422 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 420 def update spec[UPDATE] end |
#updates ⇒ Array<BSON::Document>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The update documents from the spec.
409 410 411 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 409 def updates spec[UPDATES] end |
#user ⇒ Auth::User
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The user for user related operations.
432 433 434 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 432 def user spec[USER] end |
#user_name ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The user name from the specification.
444 445 446 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 444 def user_name spec[USER_NAME] end |
#write_concern ⇒ Mongo::WriteConcern
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The write concern to use for this operation.
456 457 458 |
# File 'build/ruby-driver-v2.19/lib/mongo/operation/shared/specifiable.rb', line 456 def write_concern @spec[WRITE_CONCERN] end |