In mongodb what is the difference between the error code 11000 and the error code 11001?

0

I hardly understand that error 11000 is about conflict that exists.

Error 11001 I can not figure out I have this code

if(error.code === 11000 || error.code === 11001){
      var apiError = new ApiErrors.ValidationError(error.errmsg || 'There was 
      a duplicate key error', 409);
        next(apiError);
}

what would be your difference?

    
asked by Juan José Suarez Romero 07.07.2017 в 18:51
source

1 answer

0

Based on the reference response, raise 11000 if a insert is made for an existing key, and 11001 if instead of insert a update is made % for more than the error text, for this last case, say 11000 .

Ref: MongoDB difference between error code 11000 and 11001

    
answered by 07.07.2017 в 23:53