-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:
After updating to rails 4 i got this strange issue. Im using mongoid 4.0.0.
Here is stacktrace for error
Error while toggling environment: The operation: #<Moped::Protocol::Command
@length=89
@request_id=16
@response_to=0
@op_code=2004
@flags=[]
@full_collection_name="feedbackzilla_development.$cmd"
@skip=0
@limit=-1
@selector={:getlasterror=>1, :w=>1}
@fields=nil>
failed with error 11000: "E11000 duplicate key error index: feedbackzilla_development.activity_logs.$id dup key: { : ObjectId('5280dc64416c65109e780000') }"
See https://github.com/mongodb/mongo/blob/master/docs/errors.md
for details about this error.
I'm using sidekiq to do some background job, here is code that causing this issue:
<pre><code>
user.sim_customers.destroy_all
user.sim_activity_logs.destroy_all
....
sim_customer = SimCustomer.create!(live_customer.attributes)
</code></pre>
I have deleted everything from SimCustomer model, so there were no indices to conflict with