lib/mongo/operation/shared/specifiable.rb in mongo-2.15.1 vs lib/mongo/operation/shared/specifiable.rb in mongo-2.16.0.alpha1
- old
+ new
@@ -58,15 +58,10 @@
# The field for cursor id.
#
# @since 2.0.0
CURSOR_ID = :cursor_id.freeze
- # The field for cursor ids.
- #
- # @since 2.0.0
- CURSOR_IDS = :cursor_ids.freeze
-
# The field for an index.
#
# @since 2.0.0
INDEX = :index.freeze
@@ -236,11 +231,11 @@
#
# @return [ String ] Collection name.
#
# @since 2.0.0
def coll_name
- spec[COLL_NAME]
+ spec.fetch(COLL_NAME)
end
# The id of the cursor created on the server.
#
# @example Get the cursor id.
@@ -251,22 +246,10 @@
# @since 2.0.0
def cursor_id
spec[CURSOR_ID]
end
- # The ids of the cursors to kill from the spec.
- #
- # @example Get the cursor ids from the spec.
- # specifiable.cursor_ids
- #
- # @return [ Array<Integer> ] The cursor ids.
- #
- # @since 2.0.0
- def cursor_ids
- spec[CURSOR_IDS]
- end
-
# Get the index from the specification.
#
# @example Get the index specification.
# specifiable.index
#
@@ -534,21 +517,10 @@
# @since 2.5.0
def txn_num
@spec[:txn_num]
end
- # For createIndexes operations, the number of votes that a primary must
- # wait for before commiting an index. Potential values are:
- # - an integer from 0 to the number of members of the replica set
- # - "majority" indicating that a majority of data bearing nodes must vote
- # - "votingMembers" which means that all voting data bearing nodes must vote
- #
- # @return [ nil | Integer | String ] The commitQuorum value of the operation.
- def commit_quorum
- @spec[:commit_quorum]
- end
-
# The command.
#
# @return [ Hash ] The command.
#
# @since 2.5.2
@@ -577,9 +549,19 @@
# @return [ Boolean ] Whether or not the operation has an acknowledged write concern.
#
# @since 2.5.2
def acknowledged_write?
write_concern.nil? || write_concern.acknowledged?
+ end
+
+ 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
end
end
end