the code:
> db.mycoll.insert( {num:3, text:"smth", date: new Date(), childs:[1,2,3]})
> var rec = db.mycoll.findOne();
> for (key in rec) {
var val = rec[key];
print( key + "(" + typeof(val) + "): " + val ) }
will print:
_id(object): 4e2d688cb2f2b62248c1c6bb
num(number): 3
text(string): smth
date(object): Mon Jul 25 2011 15:58:52 GMT+0300
childs(object): 1,2,3
(javascript array and date is just an βobjectβ)
This shows the βoutlineβ of only the top level, if you want to look deeper, you need some recursive tree walk function.
zmila source
share