MongoDB Complete Guide
US$ 19.95
The publisher has enabled DRM protection, which means that you need to use the BookFusion iOS, Android or Web app to read this eBook. This eBook cannot be used outside of the BookFusion platform.
Description
Contents
Reviews
Language
English
ISBN
9789389898866
Cover Page
Title Page
Copyright Page
Dedication Page
About the Author
About the Reviewers
Acknowledgement
Preface
Errata
Table of Contents
1. Introduction to MongoDB
Structure
Objectives
Introduction
The definition of MongoDB
What is a document database?
What is JSON? How does it look?
Cross-platform
Scalable
Flexible
Classified as NoSQL database
What is a NoSQL database?
An overview of the MongoDB architecture
A quick look into the NoSQL database architecture
A quick look into the MongoDB architecture
MongoDB data platform
Difference from other databases
The concept of NoSQL databases
Types of NoSQL database management systems
Key-value paired databases
Column-oriented databases
Document databases
Graph databases
Introduction to MongoDB basics, core concepts, and vocabulary
Document database
Collections
Support for rich query language
Support multiple storage engines
Some basic MongoDB terminology
MongoDB terminology comparison with SQL databases
Conclusion
Questions
2. MongoDB Installation Setup on Windows
Structure
Objectives
Overview of MongoDB editions
Features of MongoDB Enterprise Advanced Edition
Comparison between MongoDB Community Edition and MongoDB Enterprise Advanced Edition
MongoDB setup on Windows
Installing MongoDB Community Edition on Windows operating system
Installation steps
Conclusion
Questions
3. MongoDB Installation and Setup on Linux (Ubuntu)
Structure
Objectives
MongoDB Setup on Linux
Installing MongoDB Community Edition on Linux Operating System
Installation steps
Method one (Browser method)
Step 1 – Download MongoDB Community Edition
Step 2 – Install MongoDB Community Edition on your Linux machine
Installation Steps
Method two (Shell method)
Steps for installing MongoDB clients (mongo-clients) on Linux based systems (Ubuntu)
Steps for installing MongoDB on Linux based systems (Ubuntu) using the Shell commands
Step 3 –Starting MongoDB on Linux (Ubuntu)
Step 4 – Connecting to MongoDB on Linux (Ubuntu)
Conclusion
Questions
4. MongoDB Installation and Setup on macOS
Structure
Objectives
MongoDB setup on macOS
Installing MongoDB Community Edition on macOS
Installation steps
Conclusion
Questions
5. Getting Started with MongoDB
Structure
Objectives
MongoDB databases
What is a database?
What is a relational database?
What is a NoSQL database?
What is a MongoDB database?
MongoDB collections
What is a table in RDBMS?
What is a collection in MongoDB?
MongoDB documents
Row and column in RDBMS
What is a document in MongoDB?
Introduction to MongoDB Shell
What is a MongoDB Shell?
Connecting to MongoDB Shell
Step 1 – Connecting to MongoDB Shell
Basic Shell commands
MongoDB Shell basic command helpers
MongoDB Shell command history
Introduction to MongoDB clients
Conclusion
Questions
6. Storage Engines in MongoDB
Structure
Objectives
What are storage engines?
Types of storage engines in MongoDB
Introduction to the WiredTiger storage engine
Introduction to the in-memory storage engine
Encrypted storage engine
Third-party pluggable storage engines
MongoDB storage engines comparison
MongoDB locks
What is a database lock?
Database lock operations types
Database locks operations in MongoDB
Conclusion
Questions
7. Managing and Administering MongoDB
Structure
Objectives
MongoDB administration commands and methods
Create database command
Create collection command
Drop database command
Drop collection command
MongoDB query and write operation commands and methods
Insert document command
Read document command
Delete document command
MongoDB user authentication and role based commands and methods
What is database authentication?
What is role-based access control?
Role-based authentication in MongoDB
Conclusion
Questions
8. MongoDB Shell Methods
Structure
Objectives
JavaScript in MongoDB
Server Side JavaScript in MongoDB
What is map-reduce in MongoDB?
What is $where operator in MongoDB?
List of officially supported languages in MongoDB
MongoDB methods
Step 1 – Connecting to MongoDB Shell
MongoDB connection methods
connect(url,username,password)
Mongo(host, clientSideOptions)
Mongo.getDB(database)
MongoDB database methods
db.getMongo()
db.stats()
db.serverStatus()
MongoDB Collection methods
db.collection.count()
db.collection.stats()
db.collection.totalSize()
db.collection.validate()
db.collection.drop()
MongoDB cursor methods
What is a cursor in MongoDB?
cursor.count()
cursor.pretty()
cursor.sort()
Conclusion
Questions
9. Data Types in MongoDB
Structure
Objectives
What are data types?
Introduction to BSON data types
Data types in MongoDB
Integer data types
String data types
Double data types
Array data types
Object data types
Binary data types
ObjectId data types
Date data types
Null data types
Regular expression data types
JavaScript data types (without scope)
Javascript data types (with scope)
Timestamp data types
Boolean data types
Min and max key
Decimal128
Comparison and sort order
Conclusion
Questions
10. Introduction to MongoDB CRUD Operations
Structure
Objectives
MongoDB create operations
db.collection.insert() method
Method definition
Example 1 – Creating a single document in MongoDB collection
Example 2 – Creating multiple documents in MongoDB collection
db.collection.insertOne() method
Method definition
Example – Creating a single document in MongoDB Collection using insertOne() method
db.collection.insertMany() method
Method definition
Example – Creating multiple documents in MongoDB collection using insertMany() method
The _id Field
Example - Creating a new document by specifying _id key
The ordered option
MongoDB read operations
db.collection.find() Method
Method Definition
Example 1 – Reading documents in MongoDB collection without Query
Example 2 – Reading documents in MongoDB collection with Query
Using Pretty method with find()
Example 3 – Reading documents in MongoDB collection with Query and Pretty method
MongoDB update operations
The $set operator
The $unset operator
db.collection.update() method
Method definition
Example 1 – Updating a single document in MongoDB collection using update() method
Example 2 – Updating multiple documents in MongoDB collection using update() method
db.collection.updateOne() method
Method definition
Example – Updating a single document in MongoDB collection using updateOne() method
db.collection.updateMany() method
Method definition
Example – Updating multiple documents in MongoDB collection using updateMany() method
The upsert option
The multi option
MongoDB delete operations
db.collection.remove() method
Method definition
The justOne option
Example 1 – Deleting a single document in MongoDB collection using remove() method
Example 2 – Deleting multiple documents in MongoDB collection using remove() method
db.collection.deleteOne() method
Method definition
Example – Deleting a single document in MongoDB collection using deleteOne() method
db.collection.deleteMany() method
Method definition
Example – Deleting multiple documents in MongoDB collection using deleteMany() method
MongoDB bulk write operations
db.collection.bulkWrite() method
Method definition
Example – Bulk write in MongoDB collection using bulkwrite() method
Conclusion
Questions
11. MongoDB Intermediate Concepts
Structure
Objectives
Atomicity
What is atomicity?
Atomicity in MongoDB
MongoDB atomicity and multiple document transactions
Consistency
What is consistency?
Consistency in MongoDB
MongoDB and eventual consistency
Basic introduction to replication
Replica sets
Basic introduction to sharding
Sharded clusters
Distributed operations and queries
Read operations on replica sets
Write operations on replica sets
Read operations on sharded clusters
Write operations on sharded clusters
Conclusion
Questions
12. Introduction to MongoDB Indexes
Structure
Objectives
What are indexes?
Indexing and MongoDB
Benefits of indexing
Default _id index
The _id properties
Code 1
Code 2
Creating an index
db.collection.createIndex() method
Method definition
Example – Creating an index in MongoDB collection
Code 1
Index types in MongoDB
Single field index
Example – Creating a single field index in MongoDB collection
Code 1
Compound Index
Example – Creating a compound index in MongoDB collection
Code 1
Multikey index
Example – Creating a multikey index in a MongoDB collection
Code 1
Text index
Example – Creating a text index in a MongoDB collection
Code 1
Special types of index
Geospatial index
Hashed index
Index properties
Unique index
Example – Creating a unique index in a MongoDB Collection
Code 1
Partial index
Example – Creating a partial index in a MongoDB Collection
Code 1
Sparse index
Example – Creating a sparse index in a MongoDB collection
Code 1
TTL index
Example – Creating a TTL index in a MongoDB collection
Code 1
Using an index
Example – Creating and using an index in a MongoDB collection
Code 1
Code 2
Indexes and collation
Example – Creating an index with collation in a MongoDB Collection
Code 1
View index information
db.collection.getIndexes() method
Example – Viewing all the Indexes in a MongoDB Collection
Code 1
Deleting an index
db.collection.dropIndex() method
Method definition
Example 1 – Deleting an index in a MongoDB collection
Code 1
db.collection.dropIndexes() method
Method definition
Example 2 – Deleting multiple index in a MongoDB collection
Code 1
Example 3 – Deleting multiple index in a MongoDB collection using the array type values as parameter
Code 1
Example 4 – Deleting all the indexes in a MongoDB collection
Code 1
Some restrictions in MongoDB index
Conclusion
Points to Remember
Multiple choice questions
Answer
Questions
Key terms
13. MongoDB Query Selectors
Structure
Objectives
Introduction to query selectors
Comparison Selectors
Logical Selectors
Element Selectors
Evaluation Selectors
Geospatial Selectors
Bitwise Selectors
Comment Selector
Examples and use of query selectors
Code 1
Code 2
Examples of comparison selectors
Example 1 - $gt Comparison Selector
Code 1
Selector Details
Example 2 - $lte comparison selector
Code 1
Selector Details
Example 3 - $in comparison selector
Code 1
Selector Details
Examples of logical selectors
Example 1 - $and logical selector
Code 1
Selector Details
Example 2 - $not logical selector
Code 1
Selector details
Examples of element selectors
Example 1 - $exists element selector
Code 1
Selector details
Examples of array selectors
Example 1 - $all array selector
Code 1
Selector Details
Examples of evaluation selectors
Example 1 - $regex evaluation selector
Code 1
Selector details
Conclusion
Questions
14. Projection in MongoDB and Projection Operators
Structure
Objectives
Introduction to projection
How to use projection in MongoDB?
Examples of projection
Example 1 - Show only specific fields
Example 2 - Hide specific fields
Example 1 - Show only specific fields and hide the _id field
Introduction to projection operators
Examples of projection operators
Example 1 - $ projection operator
Operator details
Example 2 - $elemMatch projection operator
Operator details
Conclusion
Questions
15. Aggregation in MongoDB
Structure
Objectives
Introduction to MongoDB aggregation
Aggregation method syntax and use
Examples and use of aggregation method
Examples of aggregation
The MongoDB $group operator
Example 1 - $sum aggregation expression type
Expression type details
Example 2 - $sum aggregation expression type with operation in group output
Example 3 - $sum aggregation expression type with some other field
Example 4 - $avg aggregation expression type
Expression type details
Example 5 - $max aggregation expression type
Expression type details
Example 6 - $push aggregation expression type
Expression type details
Example 7 - $last aggregation expression type
Expression type details
Introduction to map-reduce
The mapReduce() method
Example 1 – mapReduce()
Introduction to aggregation pipeline
What is pipeline?
MongoDB aggregation pipeline
Example 1 – aggregate()
Example 2 – aggregate() with $out
Conclusion
Questions
16. MongoDB Data Manipulations Using MongoDB Compass
Structure
Objectives
Introduction to MongoDB Compass
Installing MongoDB Compass
Installing MongoDB Compass on Windows operating system
Connecting MongoDB Server with MongoDB Compass
Practical examples with MongoDB Compass
Example 1 –Browsing the collections in the database
Example 2–Creating new collection in the database
Example 3–Browsing documents in the database
Example 4–Performing CRUD operations in documents
Example 5–Editing a document
Conclusion
Questions
Points to remember
Multiple choice questions
Answer
Key terms
17. Managing and Administering MongoDB (Advanced Level)
Structure
Objectives
About mongod process
Managing mongod process
MongoDB service in Windows
Running mongod from command prompt
Stopping MongoDB services from Windows service manager
Stopping MongoDB Services from command line – MongoDB Shell method
Monitoring and diagnosing MongoDB
Installing MongoDB tools and utilities
Verifying the installation of MongoDB tools and utilities
Working with MongoDB tools and utilities
mongostat
mongotop
serverStatus
dbStats
collStats
buildInfo
hostInfo
listCommands
ping
getLog
Backup and restore with MongoDB
Taking a MongoDB backup using mongodump
Restoring a MongoDB database using mongorestore
Import and export with MongoDB
Exporting a MongoDB data using mongoexport
Importing a MongoDB data using mongoimport
MongoDB security
Enable authentication
Use role-based authorization (role-based access control)
Encrypt the communication channels and connections
Encrypt your MongoDB data
Use firewalls and restrict all the incoming and outgoing traffic
Regularly perform security audits
Conclusion
Questions
18. Replication in MongoDB
Structure
Objectives
Basic introduction to replication – quick recap
Replica sets
MongoDB heartbeats
Automatic election of the new primary member
Pre-configuration steps
Starting with the MongoDB replication on Windows machine
Verifying the MongoDB replication using data
Conclusion
Questions
19. Sharding in MongoDB
Structure
Objectives
Basic introduction to sharding – quick recap
Sharded clusters
Read and write operations and importance of config database
Shard key
Pre-configuration steps
Starting with MongoDB sharding on Windows machine
Step 1 –Stop the existing MongoDB services on Windows machine
Step 2 – Create the first replica set (our first shard)
Step 3 – Create the second replica set (our second shard)
Step 4 – Create the third replica set (our third shard)
Step 5 – Create the replica set of config servers in the sharded environment
Step 6 - Starting MongoDB in the sharded environment as "mongos"
Step 7 – Adding MongoDB in the shard keys
Step 8 - Verifying the MongoDB sharding using data
Conclusion
Questions
Index
The book hasn't received reviews yet.