Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct type declaration fails isPrivate #8

Closed
voliva opened this issue Aug 4, 2015 · 1 comment
Closed

Direct type declaration fails isPrivate #8

voliva opened this issue Aug 4, 2015 · 1 comment

Comments

@voliva
Copy link

voliva commented Aug 4, 2015

If you declare an schema such as:

var userSchema = new Schema({
    username: String,
_password: String
})

That's perfectly valid for mongoose, toJSON will show the field _password because it's not detected properly in isPrivate method.

Atm, this is the ifthat fails:

else if(_.isObject(node) && !node.type && !node.getters) {

since node is the type String (internally that's a function) and underscore returns isObject as true.

Maybe the solution is like

else if(_.isObject(node) && !_.isFunction(node) && !node.type && !node.getters) {
@yamadapc
Copy link
Owner

yamadapc commented Aug 7, 2015

Yeah... I'll think of something, thanks for the report! A PR would be greatly appreciated, since I'm not that free on time at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants