@@ -335,17 +335,6 @@ def reset_error_history
335335 command ( :reseterror => 1 )
336336 end
337337
338- # @deprecated please use Collection#find to create queries.
339- #
340- # Returns a Cursor over the query results.
341- #
342- # Note that the query gets sent lazily; the cursor calls
343- # Connection#send_message when needed. If the caller never requests an
344- # object from the cursor, the query never gets sent.
345- def query ( collection , query , admin = false )
346- Cursor . new ( self , collection , query , admin )
347- end
348-
349338 # Dereference a DBRef, returning the document it points to.
350339 #
351340 # @param [Mongo::DBRef] dbref
@@ -406,7 +395,7 @@ def drop_index(collection_name, index_name)
406395 oh = BSON ::OrderedHash . new
407396 oh [ :deleteIndexes ] = collection_name
408397 oh [ :index ] = index_name
409- doc = command ( oh )
398+ doc = command ( oh , :check_response => false )
410399 ok? ( doc ) || raise ( MongoDBError , "Error with drop_index command: #{ doc . inspect } " )
411400 end
412401
@@ -434,23 +423,6 @@ def stats
434423 self . command ( { :dbstats => 1 } )
435424 end
436425
437- # Create a new index on the given collection.
438- # Normally called by Collection#create_index.
439- #
440- # @param [String] collection_name
441- # @param [String, Array] field_or_spec either either a single field name
442- # or an array of [field name, direction] pairs. Directions should be specified as
443- # Mongo::ASCENDING or Mongo::DESCENDING.
444- # @param [Boolean] unique if +true+, the created index will enforce a uniqueness constraint.
445- #
446- # @return [String] the name of the index created.
447- #
448- # @deprecated
449- def create_index ( collection_name , field_or_spec , unique = false )
450- warn "DB#create_index is now deprecated. Please use Collection#create_index instead."
451- self . collection ( collection_name ) . create_index ( field_or_spec , :unique => unique )
452- end
453-
454426 # Return +true+ if the supplied +doc+ contains an 'ok' field with the value 1.
455427 #
456428 # @param [Hash] doc
@@ -484,21 +456,14 @@ def ok?(doc)
484456 #
485457 # @core commands command_instance-method
486458 def command ( selector , opts = { } , old_check_response = false , old_sock = nil )
487- if opts . is_a? ( Hash )
488- check_response = opts [ :check_response ] . nil? ? true : opts [ :check_response ]
489- sock = opts [ :sock ]
490- else
491- warn "The options passed to DB#command should now be passed as hash keys; the admin option has been deprecated."
492- admin = opts
493- check_response = old_check_response
494- sock = old_sock
495- end
459+ check_response = opts [ :check_response ] . nil? ? true : opts [ :check_response ]
460+ sock = opts [ :sock ]
496461 raise MongoArgumentError , "command must be given a selector" unless selector . is_a? ( Hash ) && !selector . empty?
497462 if selector . keys . length > 1 && RUBY_VERSION < '1.9' && selector . class != BSON ::OrderedHash
498463 raise MongoArgumentError , "DB#command requires an OrderedHash when hash contains multiple keys"
499464 end
500465
501- result = Cursor . new ( system_command_collection , :admin => admin ,
466+ result = Cursor . new ( system_command_collection ,
502467 :limit => -1 , :selector => selector , :socket => sock ) . next_document
503468
504469 if result . nil? || ( check_response && !ok? ( result ) )
0 commit comments