(assuming the unique key is username)
In "insert" scenario, code should check the entire collection that this username has not been taken.
However, in "update" scenario, code should check the entire collection except for the current record.


----
To reproduce this, create a username and save it, then re-load the record, update any other field, you'll receive a unique field validation error (on username).