minor: nicer query opts generation
This commit is contained in:
parent
0460491863
commit
030c850669
|
@ -255,10 +255,11 @@ module Mongo
|
||||||
# @see http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-Mongo::Constants::OPQUERY
|
# @see http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-Mongo::Constants::OPQUERY
|
||||||
# The MongoDB wire protocol.
|
# The MongoDB wire protocol.
|
||||||
def query_opts
|
def query_opts
|
||||||
timeout = @timeout ? 0 : Mongo::Constants::OP_QUERY_NO_CURSOR_TIMEOUT
|
opts = 0
|
||||||
slave_ok = @connection.slave_ok? ? Mongo::Constants::OP_QUERY_SLAVE_OK : 0
|
opts |= Mongo::Constants::OP_QUERY_NO_CURSOR_TIMEOUT unless @timeout
|
||||||
tailable = @tailable ? Mongo::Constants::OP_QUERY_TAILABLE : 0
|
opts |= Mongo::Constants::OP_QUERY_SLAVE_OK if @connection.slave_ok?
|
||||||
slave_ok + timeout + tailable
|
opts |= Mongo::Constants::OP_QUERY_TAILABLE if @tailable
|
||||||
|
opts
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get the query options for this Cursor.
|
# Get the query options for this Cursor.
|
||||||
|
|
Loading…
Reference in New Issue