Browse files

fixed; setting object root to null/undefined

  • Loading branch information...
1 parent 89a968b commit 75c3277b70a5324e0e490882d0a8a20338c80a12 @aheckmann aheckmann committed Mar 31, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/mongoose/document.js
View
5 lib/mongoose/document.js
@@ -187,7 +187,10 @@ Document.prototype.pre = function (method, fn) {
*/
Document.prototype.set = function (path, val) {
- if (typeof path != 'string') {
+ if ('string' !== typeof path) {
+
+ if (null === path || undefined === path)
+ return this.set(val, path);
var prefix = val
? val + '.'

0 comments on commit 75c3277

Please sign in to comment.