NumberInt is not defined

732 views
Skip to first unread message

Brad Todd

unread,
Apr 4, 2014, 4:17:06 PM4/4/14
to mongod...@googlegroups.com
Is there a simple answer as to why this occurs?

> db.foo.insert( { _id : 3, x : NumberInt(3) } )
ReferenceError: NumberInt is not defined

Received on Try It Out in MongoDB.org

Thanks
-Brad

Charlie Page

unread,
Apr 9, 2014, 3:48:20 PM4/9/14
to mongod...@googlegroups.com
Hi Brad,

I'm having our web team look into this.  Using an unrestricted mongo shell v2.4.10 this command successfully executes.  I would suggest install mongo on your computer, it's very easy to do.  You can find the docs here: http://docs.mongodb.org/manual/installation/

- C

Stephen Steneker

unread,
Apr 14, 2014, 4:58:07 AM4/14/14
to mongod...@googlegroups.com
Hi Brad,

FYI, the simple answer is that "try.mongodb.org" is not running an actual `mongo` shell. This is only intended as a web-based tutorial to learn some of the MongoDB shell syntax, and is missing many of the features of the full shell. For example, the try.mongodb.org demo does not include tab-completion for commands, inline help, or implementation of any MongoDB commands or shell helpers that aren't needed for the quick online tutorial :).

Your example insert could be tested on try.mongodb.org using a standard JavaScript Number() instead of NumberInt():
db.foo.insert( { _id : 3, x : Number(3) } )

If you want to experience the full functionality you are best installing MongoDB on your own computer as Charlie suggested.

Regards,
Stephen
Reply all
Reply to author
Forward
0 new messages