mongo-ruby-driver/lib/mongo/message/query_message.rb
Jim Menard 7669900126 Lots of fixes.
- Introduced OrderedHash because db commands require that the command key be
  first.
- Fixed BSON (de)serialization of object ids.
- Simplified @coll.drop_indexes.
- Renamed some method parameters to make their type more clear (for example,
  "collection" became "collection_name").
- Got the index_information test working.
2008-12-08 11:38:42 -05:00

27 lines
587 B
Ruby

require 'mongo/message/message'
require 'mongo/message/opcodes'
module XGen
module Mongo
module Driver
class QueryMessage < Message
def initialize(db_name, collection_name, query)
super(OP_QUERY)
write_int(0)
write_string("#{db_name}.#{collection_name}")
write_int(query.number_to_skip)
write_int(query.number_to_return)
write_doc(query.selector)
write_doc(query.fields) if query.fields
end
def first_key(key)
@first_key = key
end
end
end
end
end