Credit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Presentation mongodb
1. Presented by: Group Members
Zubair Ahmed, Jameel Ahmed, Naeem Jan and Hassam Hamid
Instructor: Mr. Mukhtar Hussain
Class: BSCS 8th (2015-2018)
Presented by: Group Members
Date:Tuesday, September 11, 2018
Department: Computer Science
2. University ofTurbat2 |
PresentationTasks
1) Introduction to MongoDB By Jameel
Ahmed
2) Installing MongoDB By Naeem Jan
3) MongoDB Data Modelling By Zubair
Ahmed
4) MongoDB CRUD Operations By Hassam
Hamid
4. University ofTurbat4 |
The Family of NoSQL DBs
Key-values Stores
Hash table where there is a unique key and a pointer to a particular item of data.
Focus on scaling to huge amounts of data
E.g.Oracle BDB
Column Family Stores
To store and process very large amounts of data distributed over many machines
E.g.Cassandra, HBase
Document Databases
Collections of Key-Value collections
The next level of Key/value, allowing nested values associated with each key.
Appropriate for Web apps.
E.g. CouchDB, MongoDb
Graph Databases
Bases on property-graph model
Appropriate for Social networking, Recommendations
E.g. Neo4J, InfiniteGraph
Introduction to MongoDB
5. University ofTurbat5 |
MongoDB
Document-oriented NoSQL database
Schema-free
Based on Binary JSON; BSON
Organized in Group of Documents Collections
Informal namespacing
Auto-Sharding in order to scale horizontally
Simple query language. Rich, document-based queries.
Map/Reduce support
Open Source
Introduction to MongoDB
7. 7
Document store
RDBMS MongoDB
Database Database
Table,View Collection
Row Document (JSON,
BSON)
Column Field
Index Index
Join Embedded Document
Foreign Key Reference
Partition Shard
University ofTurbatIntroduction to MongoDB
8. Document store
RDBMS MongoDB
Database Database
Table,View Collection
Row Document (JSON,
BSON)
Column Field
Index Index
Join Embedded Document
Foreign Key Reference
Partition Shard
> db.user.findOne({age:39})
{
"_id" : ObjectId("5114e0bd42…"),
"first" : "John",
"last" : "Doe",
"age" : 39,
"interests" : [
"Reading",
"Mountain Biking ]
"favorites": {
"color": "Blue",
"sport": "Soccer"}
}
University ofTurbatIntroduction to MongoDB
10. University ofTurbat10 |
Installation of MongoDB
How to Download Setup
Installation of MongoDB
Open a browser
Write mongodb
Click MongoDB webite with https://www.mongodb.com
12. University ofTurbat12 |
Installation of MongoDB
Installation of MongoDB
Click on Community Server button in the menu
Choose an Operating System
Click on D OWNLOAD button
13. University ofTurbat13 |
Installation of MongoDB
Installation of MongoDB
After downloading MongoDB then double click on the setup
While installing,Accept terms and License Agreement,
Then click next
18. University ofTurbat18 |
Installation of MongoDB
Installation of MongoDB
Then go toThis Pc properties then click “Advance system setting” button
Then click on “EnvironmentVariable” to paste the path
19. University ofTurbat19 |
Installation of MongoDB
Installation of MongoDB
After, go to c:Program Files
Create a folder named Data
Create another folder named db in Data folder
32. University ofTurbat32 |
Schema Design
Relational
MongoDB Data Modelling
MongoDB
• Tabular Data-Tables,Rows and Columns
• Normalized- Flatten your data
• Columns with simple values(int, varchar)
• Related rows with foreign key references
• Indexes on values
• Databases > Collections > Documents
• Documents are monolithic units
• Embedded complex data structures
• No joins- repeat data for faster access
• Difficult to relate documents together
33. University ofTurbat33 |
Flexible Schema and Documents structure
Flexible Schema
Document Structure
MongoDB Data Modelling
1. Reference 2. Embedded Data
34. University ofTurbat34 |
Atomic operations
Atomic Operations
• supports atomic operations executed against single documents
• An atomic operation is a set of operations that appears to be merely one single
operation to the rest of the system
• It will have positive or negative results
Examples:
1. $set: Sets a particular value.
2. $unset: Removes a particular value.
3.$inc: Increments a particular value by a certain amount.
MongoDB Data Modelling
35. University ofTurbat35 |
MongoDB Data Modelling
Data types
1. String
2.Integer
3.Boolean
4.Double
5.Max/Min keys
6.Array
7.TimeStamp
8.Object
9.Null
10.Symbol
11.Date
12.Object ID
13.Binary Data
14.Regular Expression
15.JavaScript Code
MongoDB Data Modelling
36. University ofTurbat36 |
Some ConsiderationsWhile Designing Schema
Considerations
• Design your schema according to user requirements.
• Combine objects into one document if you will use them together. Otherwise
separate them (but make sure there
• should not be need of joins.
• Duplicate the data (but limited) because disk space is cheap as compare to
compute time.
• Do joins while write, not on read.
• Optimize your schema for most frequent use cases.
MongoDB Data Modelling
37. University ofTurbat37 |
Creating Database
Mongodb Shell
The use command
• Database is create using “use ” command (use DatabaseName)
Example:
MongoDB Data Modelling
>use UOTDatabase
Switched to db UOTDatabase
38. University ofTurbat38 |
Creating Database
commands
• use DatabaseName : Creating Database
• db: Currently selected Databse
• showdb: Shows all Database
MongoDB Data Modelling
39. University ofTurbat39 |
Creating collection and document
Creating collection and document
• db.movie.insert({"name":"tutorials point"})
MongoDB Data Modelling
42. University ofTurbat42 |
MongoDB CRUD Operations
Create Operations
Create Or Insert operations Add A New DocumentTo A Collection
MongoDB providesThe Following Methods to InsertA Document
1. Db.collection.insertone()
2. Db.collection.insertmany()
MongoDB CRUDOperations
43. University ofTurbat43 |
MongoDB CRUD Operations
READ Operations
Read operations retrieves documents from a collection
Methods For Reading Or Finding a document…
1. db.collection.find()
MongoDB CRUDOperations
44. University ofTurbat44 |
MongoDB CRUD Operations
UPDATE Operations
Update operations modify existing documents in a collection.
Methods For Updating…….
1. db.collection.updateone()
2. db.collection.updatemany()
3. db.collection.replaceone()
MongoDB CRUDOperations
45. University ofTurbat45 |
MongoDB CRUD Operations
DELETE Operations
Delete operations remove documents from a collection
Methods For Deleting Documents…
1. db.collection.deleteone()
2. db.collection.deletemany()
MongoDB CRUDOperations