0.0.3 • Published 9 years ago

lackey-mongoose-ref-validator v0.0.3

Weekly downloads
28
License
-
Repository
github
Last release
9 years ago

Mongoose Ref Validator

Validates model references by checking if the referenced id exists before any save.

MongoDB does not enforce referential integrity. This module helps, but there are a couple of edge cases that are not covered yet. Also, data in the database can always be manipulated using other tools/clients causing inconsistency in the relationships.

Options

onDeleteRestrict

By default nothing is checked and no action is performed on delete.

With this option we prevent the deletion of a referenced model when the current model is referencing one of its documents.

Be careful with cyclic dependencies on required properties that will prevent you from deleting any data from the database.

mongoSchema.plugin(mongooseRefValidator, {
	onDeleteRestrict: ['tags']
});
0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago