mongoose-url-slugs
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -36,3 +36,2 @@ var extend = require('extend'); | ||
schema.methods.ensureUniqueSlug = function (slug, cb) { | ||
console.log('ensureUniqueSlug Doc:', this); | ||
if (!options.index_unique) return cb(null, true, slug); | ||
@@ -70,3 +69,4 @@ var doc = this; | ||
var doc = this; | ||
if (!doc.isNew && !options.update) return next(); | ||
var currentSlug = doc.get(options.field, String); | ||
if (!doc.isNew && !options.update && currentSlug) return next(); | ||
@@ -73,0 +73,0 @@ var slugFieldsModified = doc.isNew? true : false; |
@@ -9,3 +9,3 @@ { | ||
"description": "Create URL compatiable slugs on mongoose models, ensuring uniqueness.", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"keywords": [ | ||
@@ -12,0 +12,0 @@ "mongoose slugs", |
@@ -67,3 +67,3 @@ # Mongoose URL Slugs | ||
* v0.0.4 (2014-06-10) -- Initial release. | ||
* v0.0.5 (2014-06-10) -- Initial release. | ||
@@ -70,0 +70,0 @@ |
8407