These are chat archives for Automattic/mongoose

28th
Aug 2015
Amor_aeternus
@aeternu
Aug 28 2015 06:42
in mongodb, db.collection.find({name:xxx},{age:1})
is there somebody know how to do it in nodejs
Felix Heck
@fheck
Aug 28 2015 16:23
Hey guys,

i'm new to mongoDB and mongoose. Currently I'm developing an app, where it's necessary to check, if a passed argument is a mongoose.model Object.

Is there a simpler or better solution to check than the following?
typeof myVar === 'function' && new myVar().constructor.name === 'model'