-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
Tested on mongoid 3.1.6.
>> foo = City.where(code:"ROV").first
foo = City.where(code:"ROV").first
#<City _id: 4eda5fb98792904be4001a6e, ...>
>> Benchmark.measure
{ foo.save }0.010000 0.000000 0.010000 ( 0.011395)
Now let's load some objects in a has_many relation (I intentionally do to_a to make them loaded):
>> foo.city_routes.to_a.count
1094
>> Benchmark.measure { foo.save }
10.810000 0.160000 10.970000 ( 11.404787)
As you see, saves start to be very slow. Note, that autosave is false for this relation.
Just tell me, if you need more information about the case.