minor: cleanup
This commit is contained in:
parent
df80704f77
commit
e621db732e
|
@ -112,19 +112,18 @@ module Mongo
|
|||
#
|
||||
# @param [Boolean] whether of not to take notice of skip and limit
|
||||
#
|
||||
# @return [Integer] the number of objects in the result set for this query. Does
|
||||
# not take limit and skip into account.
|
||||
# @return [Integer] the number of objects in the result set for this query.
|
||||
#
|
||||
# @raise [OperationFailure] on a database error.
|
||||
def count skip_and_limit = false
|
||||
command = BSON::OrderedHash["count", @collection.name,
|
||||
"query", @selector]
|
||||
def count(skip_and_limit = false)
|
||||
command = BSON::OrderedHash["count", @collection.name, "query", @selector]
|
||||
|
||||
if skip_and_limit
|
||||
command.merge! BSON::OrderedHash["limit", @limit] if @limit != 0
|
||||
command.merge! BSON::OrderedHash["skip", @skip] if @skip != 0
|
||||
command.merge!(BSON::OrderedHash["limit", @limit]) if @limit != 0
|
||||
command.merge!(BSON::OrderedHash["skip", @skip]) if @skip != 0
|
||||
end
|
||||
|
||||
command.merge! BSON::OrderedHash["fields", @fields]
|
||||
command.merge!(BSON::OrderedHash["fields", @fields])
|
||||
|
||||
response = @db.command(command)
|
||||
return response['n'].to_i if Mongo::Support.ok?(response)
|
||||
|
|
Loading…
Reference in New Issue