lib/mongo/query.rb in mongo-0.0.4 vs lib/mongo/query.rb in mongo-0.1.0
- old
+ new
@@ -12,11 +12,10 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# ++
-require 'socket'
require 'mongo/collection'
require 'mongo/message'
module XGen
module Mongo
@@ -25,10 +24,14 @@
# A query against a collection. A query's selector is a hash. See the
# Mongo documentation for query details.
class Query
attr_accessor :number_to_skip, :number_to_return, :order_by
+ # If true, $explain will be set in QueryMessage that uses this query.
+ attr_accessor :explain
+ # Either +nil+ or an array of hint field names.
+ attr_accessor :hint_fields
attr_reader :selector # writer defined below
# sel :: A hash describing the query. See the Mongo docs for details.
#
# return_fields :: If not +nil+, a single field name or an array of
@@ -94,9 +97,13 @@
h
end
else # nil, anything else
nil
end
+ end
+
+ def contains_special_fields
+ (@order_by != nil && @order_by.length > 0) || @explain || @hint_fields
end
end
end
end
end