The Courant Systems Group offers a server dedicated to MongoDB for semesterly course work or those interesting in simply playing around with/learning MongoDB without the hassle of setting up your own server.

Features/Restrictions

* MongoDB 4.0 using the mmapv1 engine
* One database per user (database name matches your CIMS/i6 username)
* Data quota cap of 256 MB (roughly equivalent to 1.2 million documents containing three fields each)
* Two days of rotating backups (COMING SOON)
* Connectivity is limited to the NYU network.  That is, you must be connected to the wired or wireless NYU network, or you must use the VPN.

Hostname and MongoDB port

class-mongodb.cims.nyu.edu:27017

Usage

First, head on over to MongoDB Manager for Classes to initialize your database.  Please note that this page may take a short period to load if it hasn't been accessed by anyone recently.  If it times out, please try it again.  Once you initialize your database, you will receive a password specifically for your MongoDB.  This password is independent of all other Courant services and is solely used for connecting to *your* MongoDB database.

Connecting from a CIMS Linux machine

module load mongodb-4.0
mongo <dbname> --host class-mongodb.cims.nyu.edu -u <username> -p

Example:

user123@snappy5[~]$ module load mongodb-4.0
user123@snappy5[~]$ mongo user123 --host class-mongodb.cims.nyu.edu -u user123 -p
MongoDB shell version: 4.0.22
Enter password:
connecting to: class-mongodb.cims.nyu.edu:27017/user123

Connecting from a personal machine

Head on over to the official MongoDB Downloads page and download MongoDB for your operating system and install it.  Find the "mongo" executable, and connect with the same syntax/format as above in the "Connecting from a CIMS machine" section.  Keep in mind here that you'll need to be connected to the NYU network in some way, either wired, wireless, or through the VPN.

Third Party Tools

There are a number of tools available for connecting to and interacting with MongoDB. One of the best tools that we've found that is compatible with MongoDB 3.2.0 is Studio 3T (formerly MongoChef). Studio 3T is free for personal, non-commercial use, and available for Windows, Mac OS X, and Linux. If you intend to use MongoChef for monetary gain, please do the right thing and support the developers by obtaining a license. An educational discount is available for the Pro version.

Code Samples [Python 3.x via PyMongo]

user123@snappy5[~]$ python
Python 3.4.1 (default, Sep 30 2014, 15:29:28)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymongo
>>> client = pymongo.MongoClient("class-mongodb.cims.nyu.edu")
>>> client.user123.authenticate("user123", "mypassword", mechanism="SCRAM-SHA-1")
True
>>> db = client["user123"]
>>> db.collection_names()
['system.indexes']
>>> new_collection = db["my_new_collection"]
>>> my_item = { "field1" : "123",
...  "field2" : "abc",
...             "field3" : [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] }
>>> new_id = new_collection.insert_one(my_item).inserted_id
>>> new_id
ObjectId('566b486ceb442f37b37a74d5')
>>> db.collection_names()
['my_new_collection', 'system.indexes']
>>> new_collection.find_one({"_id": new_id})
{'field2': 'abc', 'field1': '123', 'field3': [1, 2, 3, 4, 5, 6, 7, 8, 9], '_id': ObjectId('566b486ceb442f37b37a74d5')}
Please visit the PyMongo tutorial for more code samples.

Support

Please contact helpdesk@cims.nyu.edu for technical support with this service, making sure to include all input/output as well as possible steps that we can take to re-create your problem.  For detailed MongoDB usage (how to perform queries, inserts, etc.), please consult the MongoDB documentation: https://docs.mongodb.org/manual/contents/