mongo_odm 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/mongo_odm/collection.rb +9 -1
- data/lib/mongo_odm/version.rb +1 -1
- metadata +2 -2
data/lib/mongo_odm/collection.rb
CHANGED
@@ -11,15 +11,19 @@ module MongoODM
|
|
11
11
|
hint = opts.delete(:hint)
|
12
12
|
snapshot = opts.delete(:snapshot)
|
13
13
|
batch_size = opts.delete(:batch_size)
|
14
|
+
|
14
15
|
if opts[:timeout] == false && !block_given?
|
15
16
|
raise ArgumentError, "Timeout can be set to false only when #find is invoked with a block."
|
17
|
+
else
|
18
|
+
timeout = opts.delete(:timeout) || false
|
16
19
|
end
|
17
|
-
|
20
|
+
|
18
21
|
if hint
|
19
22
|
hint = normalize_hint_fields(hint)
|
20
23
|
else
|
21
24
|
hint = @hint # assumed to be normalized already
|
22
25
|
end
|
26
|
+
|
23
27
|
raise RuntimeError, "Unknown options [#{opts.inspect}]" unless opts.empty?
|
24
28
|
|
25
29
|
cursor = MongoODM::Cursor.new(self, :selector => selector, :fields => fields, :skip => skip, :limit => limit,
|
@@ -33,6 +37,10 @@ module MongoODM
|
|
33
37
|
end
|
34
38
|
end
|
35
39
|
|
40
|
+
def find_and_modify(opts = {})
|
41
|
+
MongoODM.instanciate(super)
|
42
|
+
end
|
43
|
+
|
36
44
|
def insert(doc_or_docs, options={})
|
37
45
|
doc_or_docs = [doc_or_docs] unless doc_or_docs.is_a?(Array)
|
38
46
|
super doc_or_docs.map{|doc| doc.respond_to?(:to_mongo) ? doc.to_mongo : doc}
|
data/lib/mongo_odm/version.rb
CHANGED