LearnBoost/mongoose — Issue #758: Default value for Array type is wrong.
Author: jerem
Created: 2012-03-02 18:09:36+00:00
State: open

Please see the code that reproduce the issue: https://gist.github.com/1960072

The default value for an array is [] so if you have a doc that doesn't contain this array and you try to delete it Mongoose will try to unset it while it doesn't exist. So Mongoose will fire a useless update command to mongodb.

As you can see in the test code, it works correctly with a String or a Number.