I've just published four new Mongoose plugins. I would love input from anyone who stumbles across them. Most of these aren't anything new. The key difference is they're designed to work together and add logic to each other.
They new plugins are:
audit.modified (Date), and
audit.member (ObjectID, GUID, or Identifier) for the schema.
toJSON() functionality to automatically hide attributes based on the current user level. Also allows converting schema key names (ie
ad:, etc.) to proper JSON paths (ie
delete() operations to prevent the removal of data from the database. Instead of deleting the data, the
audit.deleted (Date) field is modified to indicate the item is now "deleted". Also overrides
update() operations to include this new status and exclude the documents marked as "deleted". Additionally adds
*WithDeleted() versions of these operations to allow working with deleted documents.
Accommodates additional validation attributes on schema fields. For example:
uuid:Ensures the supplied value is a valid
minLength:: Enforces string length for optional values.
minQty:: Enforces subdocument / array quantity.
validChars:: Simple string validation without using RegEx.
isCaseSensitive:: Used with
More to come... assuming folks have input on what to add.