Skip to content

Instantly share code, notes, and snippets.

@svetlyak40wt
Created February 20, 2013 09:26
Show Gist options
  • Save svetlyak40wt/4994246 to your computer and use it in GitHub Desktop.
Save svetlyak40wt/4994246 to your computer and use it in GitHub Desktop.
Issue with duplicate key ignorance
TESTS> (defparameter *db* (make-instance 'mongo:database :name "pizzbook"))
*DB*
TESTS> (defparameter *test-collection* (mongo:collection *db* "the-test"))
*TEST-COLLECTION*
TESTS> (mongo:insert-op *test-collection* (son "_id" "blah" "other" "field"))
; No value
TESTS> (mongo:insert-op *test-collection* (son "_id" "blah" "other" "another value"))
; No value
TESTS> (mongo:run-command *db* (son "getLastError" t))
{"err" => "E11000 duplicate key error index: pizzbook.the-test.$_id_ dup key: { : \"blah\" }", "code" => 11000, "n" => 0, "connectionId" => 4\
480, "ok" => 1.0d0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment