0% found this document useful (0 votes)
5 views

Chapter 2

Uploaded by

Nurul Syaheera
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Chapter 2

Uploaded by

Nurul Syaheera
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

BENR2423

Week 02:

Database and Introduction to JSON

Cloud System
• JavaScript Object Notation (JSON)
• Connecting to the Mongodb
• Mongo shell
• Javascript script

Learning Outcome
• JavaScript Object Notation (JSON)
• light-weight
• language independent
• Easy to read and write
• Text based, human readable data exchange format

{
"firstName" : "Chaitanya",
"lastName" : "Singh",
"age" : 28
}

JSON
• Standard JSON Format

{
"firstName" : "Chaitanya",
"lastName" : "Singh",
"age" : 28

JSON
• Standard JSON Format

{ key : value
"firstName" : "Chaitanya",
"lastName" : "Singh",
"age" : 28
}

JSON
• Standard JSON Format

{
"firstName" : "Chaitanya",

"lastName" : "Singh", Data Separation


"age" : 28
}

JSON
• Standard JSON Format

{
"firstName" : "Chaitanya",
"lastName" : "Singh",
"age" : 28,
"phone" :{
"mobile" : "0104001000", Sub-Document
"office" : "6064442022" (object list)
}
}

JSON
• Standard JSON Format

{
"firstName" : "Chaitanya",
"lastName" : "Singh",
"age" : 28,
"phone" : [
"0104001000", Array Value
"6064442022" (array list)
]
}

JSON
• Standard JSON Format

{
"firstName" : "Chaitanya",
"lastName" : "Singh",
"age" : 28,
"phone" : [
{"mobile" : "0104001000"}, Array of Key : Value
{"office" : "6064442022”}
(array of object-list)
]
}

JSON
{
"firstName" : "Chaitanya", string
"lastName" : "Singh",
"age" : 28,
"married" : false,
"phone" : null
}

JSON Variable Types


{
"firstName" : "Chaitanya",
"lastName" : "Singh",
"age" : 28, number
"married" : false,
"phone" : null
}

JSON Variable Types


{
"firstName" : "Chaitanya",
"lastName" : "Singh",
"age" : 28,
"married" : false, boolean
"phone" : null
}

JSON Variable Types


{
"firstName" : "Chaitanya",
"lastName" : "Singh",
"age" : 28,
"married" : false,
"phone" : null NULL
}

JSON Variable Types


• https://jsonlint.com/

JSON Validator
• https://jsonlint.com/

JSON Validator
Mongo Shell
Mongo Shell
show dbs

Mongo Shell
use <db>

Mongo Shell
show collections

Mongo Shell
db.<collection>.find({})

Mongo Shell
Nodejs
Nodejs
Nodejs
Nodejs
Homework
https://university.mongodb.com/courses/M001/about
Homework
https://ulearn-
eet.utem.edu.my/sem2202122/mod/forum/view.php?id=31366

You might also like