-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
I can't seem to get either Mongoid or the Moped driver to let me insert an array of documents into a collection that contains duplicates without generating exceptions.
I'll gen up a test case in the next couple of days, but wondering if there is any obvious awareness that this is still potentially broken?
I saw this change https://github.com/mongoid/moped/commit/f8157b43ef0e13da85dbfcb7a6dbebfa1fc8735c
And assumed that the options is accepted.
Here is one line of my code:
FlightInfo.collection.insert(objects,:continue_on_error)
This generates the standard duplicate key error
* Moped::Errors::OperationFailure Exception: The operation
<Moped::Protocol::Command
@length=70
@request_id=59
@response_to=0
@op_code=2004
@flags=[]
@full_collection_name="syd_dw.$cmd"
@skip=0
@limit=-1
@selector={:getlasterror=>1, :w=>1}
@fields=nil>
failed with error 11000: "E11000 duplicate key error index: dw.fids.$u_index dup key: { : new Date(1352207700000), : \"QF2043\", : \"A42_1042\", : \"LANDED\" }"
And same result when I try it this way
session = FlightInfo.mongo_session
session.with(safe: false) do |session|
session[:fids].insert(objects, :continue_on_error)
end