Mongoose Extract Duplicate Field
This simple module extracts the name of a duplicate field from the Mongoose "duplicate key" error message object.
You can install it using npm:
npm install --save mongoose-extract-duplicate-field
The module exports a function. Once installed, you can import this function:
var extractDuplicateField = ;
And call it, like so:
foo;
The extractDuplicateField
function you imported extracts the name of the
duplicate field and returns it synchronously. Simple but useful stuff.