diff --git a/README.rdoc b/README.rdoc index 83d6d9a..9b9c230 100644 --- a/README.rdoc +++ b/README.rdoc @@ -2,7 +2,7 @@ This is the 10gen-supported Ruby driver for MongoDB[http://www.mongodb.org]. -Here is a quick code sample. See the MongoDB Ruby Tutorial +Here's a quick code sample. See the MongoDB Ruby Tutorial (http://www.mongodb.org/display/DOCS/Ruby+Tutorial) for much more. require 'rubygems' @@ -264,7 +264,7 @@ Random cursor fun facts: = Testing If you have the source code, you can run the tests. There's a separate rake task for testing with -the mongo_ext c extension enabled. +the mongo_ext C extension enabled. $ rake test:c diff --git a/lib/mongo/types/min_max_keys.rb b/lib/mongo/types/min_max_keys.rb index d0e81c0..3564a94 100644 --- a/lib/mongo/types/min_max_keys.rb +++ b/lib/mongo/types/min_max_keys.rb @@ -15,6 +15,20 @@ # ++ module Mongo + + # A class representing the BSON MinKey type. MaxKey will always compare greater than + # all other BSON types and values. + # + # @example Sorting (assume @numbers is a collection): + # + # >> @numbers.save({"n" => Mongo::MaxKey.new}) + # >> @numbers.save({"n" => 0}) + # >> @numbers.save({"n" => 5_000_000}) + # >> @numbers.find.sort("n").to_a + # => [{"_id"=>4b5a050c238d3bace2000004, "n"=>0}, + # {"_id"=>4b5a04e6238d3bace2000002, "n"=>5_000_000}, + # {"_id"=>4b5a04ea238d3bace2000003, "n"=>#}, + # ] class MaxKey def ==(obj) @@ -22,6 +36,19 @@ module Mongo end end + # A class representing the BSON MinKey type. MinKey will always compare less than + # all other BSON types and values. + # + # @example Sorting (assume @numbers is a collection): + # + # >> @numbers.save({"n" => Mongo::MinKey.new}) + # >> @numbers.save({"n" => -1_000_000}) + # >> @numbers.save({"n" => 1_000_000}) + # >> @numbers.find.sort("n").to_a + # => [{"_id"=>4b5a050c238d3bace2000004, "n"=>#}, + # {"_id"=>4b5a04e6238d3bace2000002, "n"=>-1_000_000}, + # {"_id"=>4b5a04ea238d3bace2000003, "n"=>1_000_000}, + # ] class MinKey def ==(obj)