adapter-mongo 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,3 +3,5 @@ pkg/*
3
3
  .bundle
4
4
  log/*
5
5
  Gemfile.lock
6
+ bin
7
+ vendor/gems
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -9,6 +9,21 @@ module Adapter
9
9
  end
10
10
  end
11
11
 
12
+ def read_multiple(*keys)
13
+ ids = keys.map { |key| key_for(key) }
14
+ docs = client.find('_id' => {'$in' => ids}).to_a
15
+ keys_and_values = docs.map { |doc| [doc.delete('_id'), doc] }
16
+
17
+ docs_by_id = Hash[keys_and_values]
18
+
19
+ result = {}
20
+ keys.each do |key|
21
+ key = key_for(key)
22
+ result[key] = docs_by_id[key]
23
+ end
24
+ result
25
+ end
26
+
12
27
  def write(key, value)
13
28
  client.save({'_id' => key_for(key)}.merge(encode(value)), {:safe => options[:safe]})
14
29
  end
@@ -1,5 +1,5 @@
1
1
  module Adapter
2
2
  module Mongo
3
- VERSION = "0.6.0"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adapter-mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -51,6 +51,7 @@ extensions: []
51
51
  extra_rdoc_files: []
52
52
  files:
53
53
  - .gitignore
54
+ - .rspec
54
55
  - .travis.yml
55
56
  - Gemfile
56
57
  - Guardfile
@@ -83,7 +84,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
83
84
  version: '0'
84
85
  segments:
85
86
  - 0
86
- hash: -1642697742902591333
87
+ hash: 1570202844735750411
87
88
  required_rubygems_version: !ruby/object:Gem::Requirement
88
89
  none: false
89
90
  requirements:
@@ -92,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  version: '0'
93
94
  segments:
94
95
  - 0
95
- hash: -1642697742902591333
96
+ hash: 1570202844735750411
96
97
  requirements: []
97
98
  rubyforge_project:
98
99
  rubygems_version: 1.8.23