Difference between revisions of "MongoDB Documents"

From mi-linux
Jump to navigationJump to search
(Blanked the page)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Main Page]] >> [[MongoDB|MongoDB]] >>[[MongoDB_Workbook|MongoDB Workbook]] >> MongoDB Documents
 
  
== Document Database ==
 
 
MongoDB is an example of a NoSQL Document database. This means in MongoDB, databases hold collections of documents. Each student has their own individual database, where documents can be created.
 
 
You can think of a record in MongoDB as being a document, which is a data structure composed of field and value pairs. 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:
 
 
<pre style="color: blue">
 
{
 
    name: "myName",
 
    roomNo: "MI412",
 
    telNo:  "2222"
 
    qualifications: ["BSc Computer Science", "MSc Advanced Computing", "PhD NoSQL Databases"]
 
    jobTitle: "Senior Lecturer"
 
}
 
</pre>
 
 
This follows a field:value pair format.
 
 
Where: name, roomNo, telNo, qualifications and jobTitle are fields and myName, MI412, 2222, ["BSc Computer Science", "MSc Advanced Computing", "PhD NoSQL Databases"] and Senior Lecturer are values.
 
 
== Collections ==
 
 
MongoDB stores its documents in a collection. Collections can be compared to tables in a relational database.
 
 
=== Create a Collection ===
 
 
If a collection does not exist, MongoDB creates the collection when you first store data for that collection.
 
 
The following example will create a collection representing the DEPT/EMP schema seen in the [[Oracle_Schema|Oracle Workbook]].
 

Latest revision as of 20:55, 18 October 2016