IM2801: Assessment - Using MongoDB for your project

by Andres Baravalle

Outline

  • Using Genghis
  • Using MongoDB

Using Genghis

Installation

If you are using your own development installation of Apache, PHP and MongoDB you can install Genghis to manage your databases.

Setting up Genghis

To use Genghis, you need to add your database connection settings (see picture).

Please make sure that you do use Genghis only in Private Mode in your browser, and that you ensure that all cookies are deleted (otherwise other students are going to be able to do CRUD operations on your DB).

Genghis is on your teaching server, in the folder /opt/genghis (no - it's not a good idea to add the full link in these slides).

Your database

Each student does have access to one database only (and unlimited collections).

To connect to the database, use the same user name and password that you use for SFTP.

Currently Genghis is available from outside UEL - that might not be the case in the next weeks.

Using Genghis

Use Genghis to check the content of your database tables - or to quickly add content into your database.

Adding records

MongoDB uses a json-like (JavaScript Object Notation) format to represent the stored data.

Genghis uses the same notation.

To add a new book, for example:

{
	title: "MongoDB: The Definitive Guide", 
	author: 
	{
		name: "Kristina", 
		surname: "Chodorow"
	},
	isbn: "1449381561",
	publication_year: 2010
}    

How should I use MongoDB?

Use MongoDB to store your application data - for example you can store your quiz questions, the answers by each user and your scoreboard.