mongoid 5.2.1 → 5.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +1 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/mongoid/atomic.rb +1 -1
  5. data/lib/mongoid/atomic/modifiers.rb +12 -8
  6. data/lib/mongoid/attributes.rb +1 -2
  7. data/lib/mongoid/attributes/dynamic.rb +3 -2
  8. data/lib/mongoid/attributes/nested.rb +1 -1
  9. data/lib/mongoid/attributes/processing.rb +0 -4
  10. data/lib/mongoid/changeable.rb +1 -1
  11. data/lib/mongoid/clients/options.rb +3 -2
  12. data/lib/mongoid/contextual/atomic.rb +9 -6
  13. data/lib/mongoid/contextual/geo_near.rb +3 -2
  14. data/lib/mongoid/contextual/map_reduce.rb +4 -0
  15. data/lib/mongoid/contextual/memory.rb +1 -1
  16. data/lib/mongoid/contextual/mongo.rb +3 -3
  17. data/lib/mongoid/contextual/none.rb +2 -2
  18. data/lib/mongoid/copyable.rb +0 -4
  19. data/lib/mongoid/criteria.rb +1 -1
  20. data/lib/mongoid/criteria/findable.rb +3 -2
  21. data/lib/mongoid/criteria/includable.rb +2 -2
  22. data/lib/mongoid/errors/delete_restriction.rb +2 -2
  23. data/lib/mongoid/errors/inverse_not_found.rb +1 -1
  24. data/lib/mongoid/extensions/hash.rb +3 -2
  25. data/lib/mongoid/extensions/object.rb +2 -2
  26. data/lib/mongoid/extensions/time.rb +1 -1
  27. data/lib/mongoid/factory.rb +0 -1
  28. data/lib/mongoid/fields/foreign_key.rb +2 -2
  29. data/lib/mongoid/findable.rb +1 -1
  30. data/lib/mongoid/indexable.rb +3 -2
  31. data/lib/mongoid/indexable/specification.rb +1 -1
  32. data/lib/mongoid/interceptable.rb +2 -2
  33. data/lib/mongoid/loggable.rb +1 -1
  34. data/lib/mongoid/matchable.rb +2 -2
  35. data/lib/mongoid/persistable.rb +0 -3
  36. data/lib/mongoid/persistable/creatable.rb +0 -2
  37. data/lib/mongoid/query_cache.rb +5 -1
  38. data/lib/mongoid/relations/accessors.rb +1 -2
  39. data/lib/mongoid/relations/bindings/embedded/in.rb +0 -4
  40. data/lib/mongoid/relations/bindings/embedded/many.rb +1 -8
  41. data/lib/mongoid/relations/bindings/embedded/one.rb +0 -10
  42. data/lib/mongoid/relations/bindings/referenced/many.rb +0 -4
  43. data/lib/mongoid/relations/builders/embedded/one.rb +1 -1
  44. data/lib/mongoid/relations/builders/nested_attributes/many.rb +1 -1
  45. data/lib/mongoid/relations/conversions.rb +1 -1
  46. data/lib/mongoid/relations/counter_cache.rb +10 -10
  47. data/lib/mongoid/relations/eager/base.rb +4 -4
  48. data/lib/mongoid/relations/embedded/batchable.rb +33 -9
  49. data/lib/mongoid/relations/embedded/in.rb +1 -3
  50. data/lib/mongoid/relations/embedded/many.rb +4 -5
  51. data/lib/mongoid/relations/embedded/one.rb +1 -3
  52. data/lib/mongoid/relations/macros.rb +2 -1
  53. data/lib/mongoid/relations/metadata.rb +3 -3
  54. data/lib/mongoid/relations/nested_builder.rb +1 -1
  55. data/lib/mongoid/relations/proxy.rb +3 -2
  56. data/lib/mongoid/relations/referenced/in.rb +1 -4
  57. data/lib/mongoid/relations/referenced/many.rb +3 -5
  58. data/lib/mongoid/relations/referenced/many_to_many.rb +1 -1
  59. data/lib/mongoid/relations/referenced/one.rb +0 -2
  60. data/lib/mongoid/relations/reflections.rb +2 -2
  61. data/lib/mongoid/scopable.rb +2 -2
  62. data/lib/mongoid/serializable.rb +3 -2
  63. data/lib/mongoid/tasks/database.rb +2 -1
  64. data/lib/mongoid/threaded.rb +4 -4
  65. data/lib/mongoid/validatable.rb +1 -1
  66. data/lib/mongoid/validatable/macros.rb +4 -2
  67. data/lib/mongoid/version.rb +1 -1
  68. data/spec/mongoid/atomic/modifiers_spec.rb +17 -17
  69. data/spec/mongoid/atomic_spec.rb +17 -17
  70. data/spec/mongoid/clients/options_spec.rb +9 -0
  71. data/spec/mongoid/contextual/atomic_spec.rb +3 -3
  72. data/spec/mongoid/persistable/savable_spec.rb +2 -2
  73. data/spec/mongoid/persistable/updatable_spec.rb +2 -2
  74. data/spec/mongoid/positional_spec.rb +10 -10
  75. data/spec/spec_helper.rb +1 -1
  76. metadata +440 -418
  77. metadata.gz.sig +0 -0
@@ -19,7 +19,8 @@ module Mongoid
19
19
  # @example Push a document.
20
20
  # person.addresses.push(address)
21
21
  #
22
- # @param [ Document, Array<Document> ] *args Any number of documents.
22
+ # @param [ Document, Array<Document> ] args Any number of documents.
23
+ #
23
24
  def <<(*args)
24
25
  docs = args.flatten
25
26
  return concat(docs) if docs.size > 1
@@ -59,7 +60,7 @@ module Mongoid
59
60
  #
60
61
  # @since 2.4.0
61
62
  def concat(docs)
62
- batch_insert(docs) unless docs.empty?
63
+ batch_push(docs) unless docs.empty?
63
64
  self
64
65
  end
65
66
 
@@ -337,8 +338,6 @@ module Mongoid
337
338
  # @example Create the binding.
338
339
  # relation.binding([ address ])
339
340
  #
340
- # @param [ Array<Document> ] new_target The new documents to bind with.
341
- #
342
341
  # @return [ Binding ] The many binding.
343
342
  #
344
343
  # @since 2.0.0.rc.1
@@ -461,7 +460,7 @@ module Mongoid
461
460
  # relation.remove_all({ :num => 1 }, true)
462
461
  #
463
462
  # @param [ Hash ] conditions Conditions to filter by.
464
- # @param [ true, false ] destroy If true then destroy, else delete.
463
+ # @param [ true, false ] method
465
464
  #
466
465
  # @return [ Integer ] The number of documents removed.
467
466
  def remove_all(conditions = {}, method = :delete)
@@ -31,7 +31,7 @@ module Mongoid
31
31
  # @example Substitute the new document.
32
32
  # person.name.substitute(new_name)
33
33
  #
34
- # @param [ Document ] other A document to replace the target.
34
+ # @param [ Document ] replacement A document to replace the target.
35
35
  #
36
36
  # @return [ Document, nil ] The relation or nil.
37
37
  #
@@ -61,8 +61,6 @@ module Mongoid
61
61
  # @example Get the binding.
62
62
  # relation.binding([ address ])
63
63
  #
64
- # @param [ Document ] new_target The new document to bind with.
65
- #
66
64
  # @return [ Binding ] The relation's binding.
67
65
  #
68
66
  # @since 2.0.0.rc.1
@@ -326,7 +326,8 @@ module Mongoid
326
326
  # Model.reference_one_to_one(:name, meta)
327
327
  #
328
328
  # @param [ Symbol ] name The name of the relation.
329
- # @param [ Metadata ] meta The relation metadata.
329
+ # @param [ Symbol ] options The association options.
330
+ # @param [ Metadata ] relation The relation.
330
331
  #
331
332
  # @return [ Class ] The model class.
332
333
  #
@@ -920,7 +920,7 @@ module Mongoid
920
920
  # @example Find the module from the parts.
921
921
  # metadata.find_from_parts([ "Namespace", "Module" ])
922
922
  #
923
- # @param [ Array<String> ] The modules.
923
+ # @param [ Array<String> ] modules The modules.
924
924
  #
925
925
  # @return [ String ] The matching module.
926
926
  #
@@ -1127,7 +1127,7 @@ module Mongoid
1127
1127
  # @example Find the inverses.
1128
1128
  # metadata.lookup_inverses(other)
1129
1129
  #
1130
- # @param [ Document ] : The inverse document.
1130
+ # @param [ Document ] other The inverse document.
1131
1131
  #
1132
1132
  # @return [ Array<String> ] The inverse names.
1133
1133
  def lookup_inverses(other)
@@ -1150,7 +1150,7 @@ module Mongoid
1150
1150
  # @example Find the inverse.
1151
1151
  # metadata.lookup_inverse(other)
1152
1152
  #
1153
- # @param [ Document ] : The inverse document.
1153
+ # @param [ Document ] other The inverse document.
1154
1154
  #
1155
1155
  # @return [ String ] The inverse name.
1156
1156
  #
@@ -25,7 +25,7 @@ module Mongoid
25
25
  # @example Is there a reject proc?
26
26
  # builder.reject?
27
27
  #
28
- # @param The parent document of the relation
28
+ # @param [ Document ] document The parent document of the relation
29
29
  # @param [ Hash ] attrs The attributes to check for rejection.
30
30
  #
31
31
  # @return [ true, false ] True and call proc or method if rejectable, false if not.
@@ -145,7 +145,8 @@ module Mongoid
145
145
  # to the target of the proxy. This can be overridden in special cases.
146
146
  #
147
147
  # @param [ String, Symbol ] name The name of the method.
148
- # @param [ Array ] *args The arguments passed to the method.
148
+ # @param [ Array ] args The arguments passed to the method.
149
+ #
149
150
  def method_missing(name, *args, &block)
150
151
  target.send(name, *args, &block)
151
152
  end
@@ -183,7 +184,7 @@ module Mongoid
183
184
  # @example returns the before_add callback method name
184
185
  # callback_method(:before_add)
185
186
  #
186
- # @param [ Symbol ] which callback
187
+ # @param [ Symbol ] callback_name Which callback
187
188
  #
188
189
  # @return [ Array ] with callback methods to be executed, the array may have symbols and Procs
189
190
  #
@@ -44,8 +44,7 @@ module Mongoid
44
44
  # @example Substitute the relation.
45
45
  # name.substitute(new_name)
46
46
  #
47
- # @param [ Document, Array<Document> ] new_target The replacement.
48
- # @param [ true, false ] building Are we in build mode?
47
+ # @param [ Document, Array<Document> ] replacement The replacement.
49
48
  #
50
49
  # @return [ In, nil ] The relation or nil.
51
50
  #
@@ -65,8 +64,6 @@ module Mongoid
65
64
  # @example Get the binding object.
66
65
  # binding([ address ])
67
66
  #
68
- # @param [ Document, Array<Document> ] new_target The replacement.
69
- #
70
67
  # @return [ Binding ] The binding object.
71
68
  #
72
69
  # @since 2.0.0.rc.1
@@ -22,7 +22,7 @@ module Mongoid
22
22
  # @example Concat with other documents.
23
23
  # person.posts.concat([ post_one, post_two ])
24
24
  #
25
- # @param [ Document, Array<Document> ] *args Any number of documents.
25
+ # @param [ Document, Array<Document> ] args Any number of documents.
26
26
  #
27
27
  # @return [ Array<Document> ] The loaded docs.
28
28
  #
@@ -190,7 +190,7 @@ module Mongoid
190
190
  # @note This will keep matching documents in memory for iteration
191
191
  # later.
192
192
  #
193
- # @param [ BSON::ObjectId, Array<BSON::ObjectId> ] arg The ids.
193
+ # @param [ BSON::ObjectId, Array<BSON::ObjectId> ] args The ids.
194
194
  #
195
195
  # @return [ Document, Criteria ] The matching document(s).
196
196
  #
@@ -368,8 +368,6 @@ module Mongoid
368
368
  # @example Get the binding.
369
369
  # relation.binding([ address ])
370
370
  #
371
- # @param [ Array<Document> ] new_target The new documents to bind with.
372
- #
373
371
  # @return [ Binding ] The binding.
374
372
  #
375
373
  # @since 2.0.0.rc.1
@@ -493,7 +491,7 @@ module Mongoid
493
491
  # person.posts.delete_all({ :title => "Testing" })
494
492
  #
495
493
  # @param [ Hash ] conditions Optional conditions to delete with.
496
- # @param [ Symbol ] The deletion method to call.
494
+ # @param [ Symbol ] method The deletion method to call.
497
495
  #
498
496
  # @return [ Integer ] The number of documents deleted.
499
497
  #
@@ -19,7 +19,7 @@ module Mongoid
19
19
  # @example Concat with other documents.
20
20
  # person.posts.concat([ post_one, post_two ])
21
21
  #
22
- # @param [ Document, Array<Document> ] *args Any number of documents.
22
+ # @param [ Document, Array<Document> ] args Any number of documents.
23
23
  #
24
24
  # @return [ Array<Document> ] The loaded docs.
25
25
  #
@@ -69,8 +69,6 @@ module Mongoid
69
69
  # @example Get the binding.
70
70
  # relation.binding([ address ])
71
71
  #
72
- # @param [ Document ] new_target The new target of the relation.
73
- #
74
72
  # @return [ Binding ] The binding object.
75
73
  def binding
76
74
  Bindings::Referenced::One.new(base, target, __metadata)
@@ -24,7 +24,7 @@ module Mongoid
24
24
  # @example Find multiple relation metadata by macro.
25
25
  # person.reflect_on_all_associations(:embeds_many)
26
26
  #
27
- # @param [ Array<Symbol> ] *macros The relation macros.
27
+ # @param [ Array<Symbol> ] macros The relation macros.
28
28
  #
29
29
  # @return [ Array<Metadata> ] The matching relation metadata.
30
30
  def reflect_on_all_associations(*macros)
@@ -50,7 +50,7 @@ module Mongoid
50
50
  # @example Find multiple relation metadata by macro.
51
51
  # Person.reflect_on_all_associations(:embeds_many)
52
52
  #
53
- # @param [ Array<Symbol> ] *macros The relation macros.
53
+ # @param [ Array<Symbol> ] macros The relation macros.
54
54
  #
55
55
  # @return [ Array<Metadata> ] The matching relation metadata.
56
56
  def reflect_on_all_associations(*macros)
@@ -80,7 +80,7 @@ module Mongoid
80
80
  # default_scope ->{ where(active: true) }
81
81
  # end
82
82
  #
83
- # @param [ Proc, Criteria ] scope The default scope.
83
+ # @param [ Proc, Criteria ] value The default scope.
84
84
  #
85
85
  # @raise [ Errors::InvalidScope ] If the scope is not a proc or criteria.
86
86
  #
@@ -136,7 +136,7 @@ module Mongoid
136
136
  # end
137
137
  #
138
138
  # @param [ Symbol ] name The name of the scope.
139
- # @param [ Proc ] conditions The conditions of the scope.
139
+ # @param [ Proc ] value The conditions of the scope.
140
140
  #
141
141
  # @raise [ Errors::InvalidScope ] If the scope is not a proc.
142
142
  # @raise [ Errors::ScopeOverwrite ] If the scope name already exists.
@@ -138,7 +138,7 @@ module Mongoid
138
138
  # @example Get the relation names.
139
139
  # document.relation_names(:include => [ :addresses ])
140
140
  #
141
- # @param [ Hash, Symbol, Array<Symbol ] inclusions The inclusions.
141
+ # @param [ Hash, Symbol, Array<Symbol> ] inclusions The inclusions.
142
142
  #
143
143
  # @return [ Array<Symbol> ] The names of the included relations.
144
144
  #
@@ -153,7 +153,8 @@ module Mongoid
153
153
  # @example Get the relation options.
154
154
  # document.relation_names(:include => [ :addresses ])
155
155
  #
156
- # @param [ Hash, Symbol, Array<Symbol ] inclusions The inclusions.
156
+ # @param [ Hash, Symbol, Array<Symbol> ] inclusions The inclusions.
157
+ # @param [ Hash ] options The options.
157
158
  # @param [ Symbol ] name The name of the relation.
158
159
  #
159
160
  # @return [ Hash ] The options for the relation.
@@ -36,7 +36,8 @@ module Mongoid
36
36
  # @example Return the list of unused indexes.
37
37
  # Mongoid::Tasks::Database.undefined_indexes
38
38
  #
39
- # @return Hash{Class => Array(Hash)} The list of undefined indexes by model.
39
+ # @return [ Array<Hash> ] The list of undefined indexes by model.
40
+ #
40
41
  def undefined_indexes(models = ::Mongoid.models)
41
42
  undefined_by_model = {}
42
43
 
@@ -64,7 +64,7 @@ module Mongoid
64
64
  # @example Set the global database override.
65
65
  # Threaded.database_override = :testing
66
66
  #
67
- # @param [ String, Symbol ] The global override name.
67
+ # @param [ String, Symbol ] name The global override name.
68
68
  #
69
69
  # @return [ String, Symbol ] The override.
70
70
  #
@@ -180,7 +180,7 @@ module Mongoid
180
180
  # @example Set the global client override.
181
181
  # Threaded.client_override = :testing
182
182
  #
183
- # @param [ String, Symbol ] The global override name.
183
+ # @param [ String, Symbol ] name The global override name.
184
184
  #
185
185
  # @return [ String, Symbol ] The override.
186
186
  #
@@ -304,7 +304,7 @@ module Mongoid
304
304
  # @example Get all autosaves.
305
305
  # Threaded.autosaves_for(Person)
306
306
  #
307
- # @param [ Class ] The class to check.
307
+ # @param [ Class ] klass The class to check.
308
308
  #
309
309
  # @return [ Array ] The current autosaves.
310
310
  #
@@ -317,7 +317,7 @@ module Mongoid
317
317
  # @example Get all validations.
318
318
  # Threaded.validations_for(Person)
319
319
  #
320
- # @param [ Class ] The class to check.
320
+ # @param [ Class ] klass The class to check.
321
321
  #
322
322
  # @return [ Array ] The current validations.
323
323
  #
@@ -144,7 +144,7 @@ module Mongoid
144
144
  # @example Validate with a specific validator.
145
145
  # validates_with MyValidator, on: :create
146
146
  #
147
- # @param [ Class<Array>, Hash ] *args The validator classes and options.
147
+ # @param [ Class<Array>, Hash ] args The validator classes and options.
148
148
  #
149
149
  # @note See ActiveModel::Validations::With for full options. This is
150
150
  # overridden to add autosave functionality when presence validation is
@@ -17,7 +17,8 @@ module Mongoid
17
17
  # validates_associated :name, :addresses
18
18
  # end
19
19
  #
20
- # @param [ Array ] *args The arguments to pass to the validator.
20
+ # @param [ Array ] args The arguments to pass to the validator.
21
+ #
21
22
  def validates_associated(*args)
22
23
  validates_with(AssociatedValidator, _merge_attributes(args))
23
24
  end
@@ -34,7 +35,8 @@ module Mongoid
34
35
  # validates_uniqueness_of :title
35
36
  # end
36
37
  #
37
- # @param [ Array ] *args The arguments to pass to the validator.
38
+ # @param [ Array ] args The arguments to pass to the validator.
39
+ #
38
40
  def validates_uniqueness_of(*args)
39
41
  validates_with(UniquenessValidator, _merge_attributes(args))
40
42
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  module Mongoid
3
- VERSION = "5.2.1"
3
+ VERSION = "5.4.0"
4
4
  end
@@ -211,10 +211,10 @@ describe Mongoid::Atomic::Modifiers do
211
211
 
212
212
  it "adds the push all modifiers" do
213
213
  expect(modifiers).to eq(
214
- { "$pushAll" =>
215
- { "addresses" => [
214
+ { "$push" =>
215
+ { "addresses" => { '$each' => [
216
216
  { "street" => "Oxford St" }
217
- ]
217
+ ] }
218
218
  }
219
219
  }
220
220
  )
@@ -238,11 +238,11 @@ describe Mongoid::Atomic::Modifiers do
238
238
 
239
239
  it "adds the push all modifiers" do
240
240
  expect(modifiers).to eq(
241
- { "$pushAll" =>
242
- { "addresses" => [
241
+ { "$push" =>
242
+ { "addresses" => { '$each' => [
243
243
  { "street" => "Hobrechtstr." },
244
244
  { "street" => "Pflugerstr." }
245
- ]
245
+ ] }
246
246
  }
247
247
  }
248
248
  )
@@ -270,10 +270,10 @@ describe Mongoid::Atomic::Modifiers do
270
270
  it "adds the push all modifiers to the conflicts hash" do
271
271
  expect(modifiers).to eq(
272
272
  { "$set" => { "addresses.0.street" => "Bond" },
273
- conflicts: { "$pushAll" =>
274
- { "addresses" => [
273
+ conflicts: { "$push" =>
274
+ { "addresses" => { '$each' => [
275
275
  { "street" => "Oxford St" }
276
- ]
276
+ ] }
277
277
  }
278
278
  }
279
279
  }
@@ -300,10 +300,10 @@ describe Mongoid::Atomic::Modifiers do
300
300
  expect(modifiers).to eq(
301
301
  { "$pullAll" => {
302
302
  "addresses" => { "street" => "Bond St" }},
303
- conflicts: { "$pushAll" =>
304
- { "addresses" => [
303
+ conflicts: { "$push" =>
304
+ { "addresses" => { '$each' => [
305
305
  { "street" => "Oxford St" }
306
- ]
306
+ ] }
307
307
  }
308
308
  }
309
309
  }
@@ -328,12 +328,12 @@ describe Mongoid::Atomic::Modifiers do
328
328
 
329
329
  it "adds the push all modifiers to the conflicts hash" do
330
330
  expect(modifiers).to eq(
331
- { "$pushAll" => {
332
- "addresses.0.locations" => [{ "street" => "Bond St" }]},
333
- conflicts: { "$pushAll" =>
334
- { "addresses" => [
331
+ { "$push" => {
332
+ "addresses.0.locations" => {'$each' => [{ "street" => "Bond St" }]}},
333
+ conflicts: { "$push" =>
334
+ { "addresses" => { '$each' => [
335
335
  { "street" => "Oxford St" }
336
- ]
336
+ ] }
337
337
  }
338
338
  }
339
339
  }
@@ -76,13 +76,13 @@ describe Mongoid::Atomic do
76
76
  person.addresses.build(street: "Oxford St")
77
77
  end
78
78
 
79
- it "returns a $set and $pushAll for modifications" do
79
+ it "returns a $set and $push and $each for modifications" do
80
80
  expect(person.atomic_updates).to eq(
81
81
  {
82
82
  "$set" => { "title" => "Sir" },
83
- "$pushAll" => { "addresses" => [
83
+ "$push" => { "addresses" => {'$each' => [
84
84
  { "_id" => "oxford-st", "street" => "Oxford St" }
85
- ]}
85
+ ] } }
86
86
  }
87
87
  )
88
88
  end
@@ -197,8 +197,8 @@ describe Mongoid::Atomic do
197
197
  "addresses.0.street" => "Bond St"
198
198
  },
199
199
  conflicts: {
200
- "$pushAll" => {
201
- "addresses.0.locations" => [{ "_id" => location.id, "name" => "Home" }]
200
+ "$push" => {
201
+ "addresses.0.locations" => { '$each' => [{ "_id" => location.id, "name" => "Home" }] }
202
202
  }
203
203
  }
204
204
  }
@@ -215,8 +215,8 @@ describe Mongoid::Atomic do
215
215
  "addresses.0.street" => "Bond St"
216
216
  },
217
217
  conflicts: {
218
- "$pushAll" => {
219
- "addresses.0.locations" => [{ "_id" => location.id, "name" => "Home" }]
218
+ "$push" => {
219
+ "addresses.0.locations" => { '$each' => [{ "_id" => location.id, "name" => "Home" }] }
220
220
  }
221
221
  }
222
222
  }
@@ -263,15 +263,15 @@ describe Mongoid::Atomic do
263
263
  "addresses.0.street" => "Bond St"
264
264
  },
265
265
  conflicts: {
266
- "$pushAll" => {
267
- "addresses" => [{
266
+ "$push" => {
267
+ "addresses" => { '$each' => [{
268
268
  "_id" => new_address.id,
269
269
  "street" => "Another",
270
270
  "locations" => [
271
271
  "_id" => location.id,
272
272
  "name" => "Home"
273
273
  ]
274
- }]
274
+ }] }
275
275
  }
276
276
  }
277
277
  }
@@ -310,15 +310,15 @@ describe Mongoid::Atomic do
310
310
  "$set" => {
311
311
  "title" => "Sir"
312
312
  },
313
- "$pushAll" => {
314
- "addresses" => [{
313
+ "$push" => {
314
+ "addresses" => { '$each' => [{
315
315
  "_id" => new_address.id,
316
316
  "street" => "Ipanema",
317
317
  "locations" => [
318
318
  "_id" => location.id,
319
319
  "name" => "Home"
320
320
  ]
321
- }]
321
+ }] }
322
322
  },
323
323
  conflicts: {
324
324
  "$set" => { "addresses.0.street"=>"Bond St" }
@@ -339,21 +339,21 @@ describe Mongoid::Atomic do
339
339
  address.locations.build(name: "Home")
340
340
  end
341
341
 
342
- it "returns the proper $sets and $pushAlls for all levels" do
342
+ it "returns the proper $sets and $pushs and $eaches for all levels" do
343
343
  expect(person.atomic_updates).to eq(
344
344
  {
345
345
  "$set" => {
346
346
  "title" => "Sir",
347
347
  },
348
- "$pushAll" => {
349
- "addresses" => [{
348
+ "$push" => {
349
+ "addresses" => { "$each" => [{
350
350
  "_id" => address.id,
351
351
  "street" => "Another",
352
352
  "locations" => [
353
353
  "_id" => location.id,
354
354
  "name" => "Home"
355
355
  ]
356
- }]
356
+ }] }
357
357
  }
358
358
  }
359
359
  )