[SOLVED] Create/Update Comments: DuplicateKeyError

I’m fairly certain my code is working, but I’m only getting 3/4 to pass the tests and can’t get past this DuplicateKeyError.

I checked the collection in Compass and don’t see any duplicate _ids, but it seems like there may be a duplicate somewhere that needs to be deleted?

It seems that, although my delete_comment() function was passing the delete_comment tests, it was still causing errors in the create_update_comments test because of an upstart=True line I had added. After removing that statement, it passed all the tests.

I am not sure if it is the case but it is something to look.

The test case is probably creating the document a first time.
Then it calls your delete code.
And finally, it verifies if your delete code works correctly by creating the same document again. If the document has been deleted correctly by your delete code, the second call to create works. If your delete code does not work correctly then you end up with a duplicate key.

It could definitely be that my delete_comment() function isn’t working properly, but it seems pretty straightforward to me and I’m not sure where the problem could be.

EDIT: the delete_comments test passes, so I’m not sure that’s ittest_delete_comments