mongo_odm 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- timeout = block_given? ? (opts.delete(:timeout) || true) : true
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}
@@ -2,6 +2,6 @@
2
2
  module MongoODM
3
3
  VERSION_MAJOR = "0"
4
4
  VERSION_MINOR = "2"
5
- VERSION_BUILD = "1"
5
+ VERSION_BUILD = "2"
6
6
  VERSION = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_BUILD}"
7
7
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Carlos Paramio