According to http://docs.mongodb.org/manual/core/shell-types/ everything in the shell is of type object
. If you want to check if a field is a certain type, you need to use instanceof
which will return a bool
.
To check the type of a field, and actually get the type. Try the following (tested on 2.4.9):
a = db.foo.findOne();
typeof a.bar
That returns number
.
EX:
It should be noted, that this is the type in JS, not necessarily the database.