No-SQL databases with MongoDB

Overview

Teaching: 15 min
Exercises: 15 min
Questions
  • How to use a MongoDB database?

Objectives
  • Get a first hand on using MongoDB

import pymongo
client = MongoClient('mongodb://mongo01.systems.wvu.edu', ssl=True, ssl_cert_reqs=pymongo.ssl_support.ssl.CERT_NONE)
client.server_info()
client.test.authenticate('training', 'training')
db=client['test']
db.collection_names()

coll=db['workshop']
ans = coll.insert_one({'a':1})
ans.acknowledged
ans.inserted_id

Key Points

  • MongoDB is a free and open-source cross-platform document-oriented database program. It stores data in JSON-like documents and fits easily for storing research data