Difference between revisions of "MongoDB Overview"
Line 33: | Line 33: | ||
This follows a '''{key:value}''' pair format. | This follows a '''{key:value}''' pair format. | ||
− | Where: ''name, roomNo, telNo, qualifications, jobTitle'' are keys | + | Where: |
+ | *''name, roomNo, telNo, qualifications, jobTitle'' are keys | ||
+ | * ''myName, MI412, 2222, ["BSc Computer Science", "MSc Advanced Computing", "PhD NoSQL Databases"], Senior Lecturer'' are values | ||
== SQL? == | == SQL? == |
Revision as of 12:27, 27 October 2016
Main Page >> MongoDB >>MongoDB Workbook >> MongoDB Overview
MongoDB is an example of a NoSQL Document Database. It works on concept of collections and documents.
Database
In MongoDB, databases hold collections of documents. Our MongoDB server supports lots of databases, since each student has their own individual database, where documents can be created.
Note: you do not need to create a database, it will be setup for you as part of the registration process.
Collection
MongoDB stores its documents in a collection. A collection can hold one or more document. Collections can be compared to tables in a relational database.
The main difference to a relational database is that MongoDB does not support joins or transactions.
Document
You can think of a document in MongoDB as being a record or row in a relational table. The document has a data structure composed of field and value pairs (enclosed in curly bracket {}), which correspond to a column in a relational table. MongoDB documents are similar to JSON objects. The documents can be complex, where the values of fields can include other documents, arrays and arrays of documents.
For example, a record for a lecturer could be:
{ name: "myName", roomNo: "MI412", telNo: "2222" qualifications: ["BSc Computer Science", "MSc Advanced Computing", "PhD NoSQL Databases"] jobTitle: "Senior Lecturer" }
This follows a {key:value} pair format.
Where:
- name, roomNo, telNo, qualifications, jobTitle are keys
- myName, MI412, 2222, ["BSc Computer Science", "MSc Advanced Computing", "PhD NoSQL Databases"], Senior Lecturer are values
SQL?
MongoDB does not support SQL, however, it can be used by a variety of languages.
The mongo shell installed on mi-linux uses Javascript to access the database.
Typical format for a command is:
db.functionName(optional_list_of_parameters);
Where db is a global variable that defaults to the current database.
Next Step
Useful URLs.