mongoid_monkey 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/patches/atomic.rb +4 -4
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0da38ef748517309df870fa4d43e8f76a874659
|
4
|
+
data.tar.gz: f7383666ee6df0a7ebaa5f508a069da887004f16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e742d660af83f2b147a6fd58776802d14689fc13a06446f0195d99a3c78218d246b212c06cbf64b351590deb88a864b0214f934ae83cc6edc8f9a9786352162
|
7
|
+
data.tar.gz: 8a24211a8bf84e5f218a4525914d22fdcc2411f548c80569f22168bcb611ec64aef49c7099ea8d1223ad7dd2630d04ade35347b89ee6badf1fb23493e2ef10fd
|
data/lib/patches/atomic.rb
CHANGED
@@ -74,7 +74,7 @@ module Atomic
|
|
74
74
|
if args.length == 1 && args.first.is_a?(Hash)
|
75
75
|
query.update_all("$push" => collect_operations(args.first, true))
|
76
76
|
else
|
77
|
-
query.update_all("$push" => { database_field_name(args[0]) => { "$each" => args[1] } })
|
77
|
+
query.update_all("$push" => { database_field_name(args[0]) => { "$each" => Array.wrap(args[1]) } })
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -104,7 +104,7 @@ module Atomic
|
|
104
104
|
|
105
105
|
def collect_operations(ops, use_each = false)
|
106
106
|
ops.inject({}) do |operations, (field, value)|
|
107
|
-
operations[database_field_name(field)] = use_each ? { '$each' => value.mongoize } : value.mongoize
|
107
|
+
operations[database_field_name(field)] = use_each ? { '$each' => Array.wrap(value.mongoize) } : value.mongoize
|
108
108
|
operations
|
109
109
|
end
|
110
110
|
end
|
@@ -123,7 +123,7 @@ module Atomic
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def operation(modifier)
|
126
|
-
{ modifier => { path =>
|
126
|
+
{ modifier => { path => { "$each" => Array.wrap(value) } } }
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
@@ -359,7 +359,7 @@ module Batchable
|
|
359
359
|
inserts = pre_process_batch_insert(docs)
|
360
360
|
if insertable?
|
361
361
|
collection.find(selector).update(
|
362
|
-
positionally(selector, operation => { path => use_each ? { '$each' => inserts } : inserts })
|
362
|
+
positionally(selector, operation => { path => use_each ? { '$each' => Array.wrap(inserts) } : inserts })
|
363
363
|
)
|
364
364
|
post_process_batch_insert(docs)
|
365
365
|
end
|
data/lib/version.rb
CHANGED