mongo_light 0.0.9 → 0.1.0

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.
@@ -26,6 +26,16 @@ module MongoLight
26
26
  c = collection || self.collection
27
27
  c.find(map(selector), map_options(opts))
28
28
  end
29
+ def find_and_modify(options = {}, collection = nil)
30
+ raw = options.delete(:raw) || false
31
+ options[:query] = map(options[:query]) if options[:query]
32
+ options[:update] = map(options[:update]) if options[:update]
33
+ options[:sort] = map_options(options[:sort]) if options[:sort]
34
+ c = collection || self.collection
35
+ found = c.find_and_modify(options)
36
+ return nil if found.nil?
37
+ raw ? unmap(found) : self.new(unmap(found))
38
+ end
29
39
  def remove(selector = {}, options = {}, collection = nil)
30
40
  c = collection || self.collection
31
41
  c.remove(map(selector), options)
@@ -1,3 +1,3 @@
1
1
  module MongoLight
2
- Version = '0.0.9'
2
+ Version = '0.1.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo_light
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: