Wednesday 7 February 2018

MongoDB Architecture And Interview Questions


MongoDB Architecture




The Following are MongoDB Core Processes/Services

Mongod – Database instance 
The primary daemon in a MongoDB system is known as mongod . This daemon handles all the data requests, manages the data format, and performs operations for background management. When a mongod is run without any arguments, it connects to the default data directory, which is C:\data\db or /data/db, and default port 27017, where it listens for socket connections. It’s important to ensure that the data directory exists and you have write permissions to the directory before the mongod process is started. If the directory doesn’t exist or you don’t have write permissions on the directory, the start of this process will fail. If the default port 27017 is not available, the server will fail to start. mongod also has a HTTP server which listens on a port 1000 higher than the default port, so if you started the mongod with the default port 27017, in this case the HTTP server will be on port 28017 and will be accessible using the URL http://localhost:28017. This basic HTTP server provides administrative information about the database.

 Mongo – an interactive shell ( a client) It is fully functional JavaScript environment for use with a MongoDB .You can have one mongos for the whole system no matter how many mongods you have  OR you can have one local mongos for every client if you wanted to minimize network latency. It provides an interactive JavaScript interface for the developer to test queries and operations directly on the database and for the system administrators to manage the database. This is all done via the command line. When the mongo shell is started, it will connect to the default database called test. This database connection value is assigned to global variable db.
As a developer or administrator you need to change the database from test to your database post the first connection is made. You can do this by using <databasename>.

Mongos - Sharding processes- It is used in sharding  environment. It is a routing and coordination process that makes the mongod  nodes in the cluster look like a single system. Mangos processes don’t store data rather they pull their state from the configserver process on startup. Any changes that occur on the configserver processes are propagated to each mongos process. Mongos processes do store some state
 For example,
open cursors from clients,losing a mongos process will invalidate these
 cursor ,but it will not result in any data loss.
Mongos processes can be run on the shard servers themselves, but they are lightweight enough to exist on each application server. Many mongos processes can be run simultaneously 
     because these processes do not coordinate with one another   
  • Analogous to a database router. 
  • Processes all requests 
  • Decides how many and which mongods should receive the query 
  • Mongos collates the results, and sends it back to the client. 

MongoDB Tools

Apart from the core services, There are various tools that are available as part of the MongoDB installation:
mongodump: This utility is used as part of an effective backup strategy. It creates a binary export of the database contents.
mongorestore: The binary database dump created by the mongodump utility is imported to a new or an existing database using the mongorestore utility. 
bsondump: This utility converts the BSON files into human-readable formats such as JSON and CSV. For example, this utility can be used to read the output file generated by mongodump.
mongoimport, mongoexport: mongoimport provides a method for taking data in JSON, CSV, or TSV formats and importing it into a mongod instance. mongoexport provides a method to export data from a mongod instance into JSON, CSV, or TSV formats.
mongostat, mongotop, mongosniff: These utilities provide diagnostic information related to the current operation of a mongod instance.

Mongodb internal process

The mongoDB has several internal processes 

The journal- The journal is a transaction log of updates to the database .Every update operation is stored in the journal before it is accepted. The journal is periodically flushed to disk. The flush typically happens every 100ms,although it sometimes happens more often for example, if active operations are explicitly waiting on a disk flush. The size of each journal flush will depend on the volume of data being written to MongoDB(e.g the amount of data updated in the last 100ms)
Background flushing – MongoDB uses mmap to access database data that is backed by your file system. After updates are written to the journal .They are applied in memory to the MMAPped version of the data files. In order to synchronize the changes in memory to the on-disk version of data, MongoDB periodically synchronizes the in-memory version of the data with the on-disk version. By default, This happened every 60 seconds but you can tune this interval with the SYNCDELAY option. The actual volume of data synched during this process will depend on your workload. If you update lots of random objects in MongoDB, you will need to write lots of random pages of memory during the sync.on the other 
Page Faults – In order for MongoDB to process an operation on an object, that object must be resident in memory. When you perform a read or write operation on an object that is not currently in memory, a page fault is triggered .In a page fault, the Operating system fetches that page from disk and loads it into memory .if your application's working set is much larger that RAM, then access requests to some objects will cause page fault before the operation can complete. Similarly if you start MongoDB cold (e.g where there is no data loaded into the Page cache ), There is warm up period where operations can trigger a lot of Page faults.(restarting the mongod process does not result in a “cold start” Scenario, because the pages are actually cached by the operating system And thus still in memory when the process restarts.) page faults are Often the largest driver of random I/O especially for databases that are larger than available memory. The size of I/O requests on underlying block devices is typically governed by Your choice of operating system, file system and block device setting, In particular , you should pay attention to the read-ahead setting on your block device to see how much data is read when a page fault occurs. Having a large setting for read ahead is typically ill advised, As it will cause the system to read more pages than necessary into memory and evicting other pages that may be useful to your application . This is particularly true for services that limit block size
What is OpLog  -  An operation log (“oplog”) is used to store write operations  during Replication. These operations replay asynchronously on other nodes. Basically the OpLog is a collection (a collection can be thought of a table in a database) of write operations (updates, deletes, inserts) which are stored in order of operation, This allows other members of the replica set (cluster) to apply these changes to the local copy of their database.

How Big Is The OpLog?
     The OpLog is a capped collection which means it only stores a certain number of records after that number is reached the oldest record is dropped from the OpLog. By default 5% of the partition where the dbpath lives is reserved for the oplog, but this is a configurable option.
     
--oplogSize <new_size_in_mb>


Application Administration: Data Files, Journaling, Authentication, and Authorization

MongoDB uses write ahead logging to an on-disk journal to guarantee  write operation durability. The MMAPv1 storage engine also requires the journal in order to provide crash resiliency.
The WiredTiger storage engine does not require journaling to guarantee a consistent state after a crash. The database will be restored to the last consistent checkpoint during recovery. However, if MongoDB exits unexpectedly in between checkpoints, journaling is required to recover writes that occurred after the last checkpoint.With journaling enabled, if mongod stops unexpectedly, the program can recover everything written to the journal. MongoDB will re-apply the write operations on restart and maintain a consistent state. By default, the greatest extent of lost writes, i.e., those not made to the journal, are those made in the last 100 milliseconds, plus the time it takes to perform the actual journal writes. See commitIntervalMs for more information on the default.

Monitor Journal Status

Use the following command to monitor journal status:

serverStatus :The serverStatus command returns database status information that is useful for assessing performance.

The following sequence preallocates journal files for an instance of mongod running on port 27017 with a database path of /data/db.For demonstration purposes, the sequence starts by creating a set of journal files in the usual way.
Create a temporary directory into which to create a set of journal files:
mkdir ~/tmpDbpath 
Create a set of journal files by starting a mongod instance that uses the temporary directory. For example:
mongod --port 10000 --dbpath ~/tmpDbpath --journal --bind_ip localhost,<ip address of the mongod host> --storageEngine mmapv1 
WARNING
Before you bind to other ip addresses, consider enabling access control and other security measures listed in Security Checklist to prevent unauthorized access.
When you see the following log output, indicating mongod has the files, press CONTROL+C to stop the mongod instance:
... NETWORK [initandlisten] waiting for connections on port 10000 
Preallocate journal files for the new instance of mongod by moving the journal files from the data directory of the existing instance to the data directory of the new instance:
mv ~/tmpDbpath/journal /data/db/ 
Start the new mongod instance. For example:
mongod --port 27017 --dbpath /data/db --journal --bind_ip localhost,<ip address 

Commands

To connect mongo
mongo easydb

Ps –ef|grep mongod

> Show Database

> Show collections

>db.students.insert ({name:"Mohan", Classification :"Freshman"})

show collection

student

db.students.fine()

 Startup and stop mongod Processes 

  • Start mongod Processes
  • Stop mongod Processes
  • Stop a Replica Set
Start mongod Processes
By default, MongoDB listens for connections from clients on port 27017, and stores data in the             /data/dbdirectory. On Windows, this path is on the drive from which you start MongoDB. 
For example, if you do not specify a --dbpath, starting a MongoDB server on the C:\ drive stores all data  files in C:\data\db.

To start MongoDB using all defaults, issue the following command at the system shell:

Mongod

Start mongod as a Daemon
To run a mongod process as a daemon (i.e. fork), and write its output to a log file, use the --fork and --logpath options. You must create the log directory; however, mongod will create the log file if it does not exist.

The following command starts mongod as a daemon and records log output to /var/log/mongodb.log.
mongod --fork --logpath /var/log/mongodb.log

Stop mongod Processes

In a clean shutdown a mongod completes all pending operations, flushes all data to data files, and closes all data files. Other shutdowns are unclean and can compromise the validity of the data files.
To ensure a clean shutdown, always shutdown mongod instances using one of the following methods:
Use shutdownServer()
Shut down the mongod from the mongo shell using the db.shutdownServer() method as follows:
use admin
db.shutdownServer()
Use --shutdown
From the Linux command line, shut down the mongod using the --shutdown option in the following command:
mongod --shutdown
Use CTRL-C
When running the mongod instance in interactive mode (i.e. without --fork), issue Control-C to perform a clean shutdown.
Use kill
From the Linux command line, shut down a specific mongod instance using one of the following commands:
kill <mongod process ID>
kill -2 <mongod process ID>
WARNING
Never use kill -9 (i.e. SIGKILL) to terminate a mongod instance.


Common Terms in MongoDB

Below are the a few of the common terms used in MongoDB 
_id – This is a field required in every MongoDB document. The _id field represents a unique value in the MongoDB document. The _id field is like the document's primary key. If you create a new document without an _id field, MongoDB will automatically create the field. So for example, if we see the example of the above customer table, Mongo DB will add a 24 digit unique identifier to each document in the collection.

_Id CustomerID CustomerName OrderID

563479cc8a8a4246bd27d784 11 Guru99 111
563479cc7a8a4246bd47d784 22 Trevor Smith 222
563479cc9a8a4246bd57d784 33 Nicole 333 

Collection – This is a grouping of MongoDB documents. A collection is the equivalent of a table which is created in any other RDMS such as Oracle or MS SQL. A collection exists within a single database. As seen from the introduction collections don't enforce any sort of structure. 
Cursor – This is a pointer to the result set of a query. Clients can iterate through a cursor to retrieve results. 
Database – This is a container for collections like in RDMS wherein it is a container for tables. Each database gets its own set of files on the file system. A MongoDB server can store multiple databases. 
Document - A record in a MongoDB collection is basically called a document. The document in turn will consist of field name and values. 
Field - A name-value pair in a document. A document has zero or more fields. Fields are analogous to columns in relational databases. 

The following diagram shows an example of Fields with Key value pairs. So in the example below CustomerID and 11 is one of the key value pair's defined in the document. 

JSON – This is known as JavaScript Object Notation. This is a human-readable, plain text format for expressing structured data. JSON is currently supported in many programming languages. 

CRUD operations

Create
  • db.collection.insert( ) 
• db.collection.save( ) 
• db.collection.update( , , { upsert: true } ) 
Read 
• db.collection.find( , ) 
• db.collection.findOne( , ) 
Update 
• db.collection.update( , , ) 
Delete 
• db.collection.remove( , )

Create Operations

Db.collection specifies the collection or the ‘table’ to store the document
 • db.collection_name.insert( ) 
• Omit the _id field to have MongoDB generate a unique key 
• Example db.parts.insert( {{type: “screwdriver”, quantity: 15 } )
 • db.parts.insert({_id: 10, type: “hammer”, quantity: 1 }) 
• db.collection_name.update( , , { upsert: true } )
  • Will update 1 or more records in a collection satisfying query 
• db.collection_name.save( )
• Updates an existing record or creates a new record 

Read Operations

• db.collection.find(<query,<projection> ).cursor modified
 • Provides functionality similar to the SELECT command 
• <query> where condition , ,<projection> fields in result set
 • Example: var PartsCursor = db.parts.find({parts: “hammer”}).limit(5) • Has cursors to handle a result set 
• Can modify the query to impose limits, skips, and sort orders.
 • Can specify to return the ‘top’ number of records from the result set
 • db.collection.findOne(<query> ,<projection> )

Query Operators

Name Description 
$eq Matches value that are equal to a specified value 
$gt, $gte Matches values that are greater than (or equal to a specified value 
$lt, $lte Matches values less than or ( equal to ) a specified value 
$ne Matches values that are not equal to a specified value 
$in Matches any of the values specified in an array 
$nin Matches none of the values specified in an array
 $or Joins query clauses with a logical OR returns all
 $and Join query clauses with a loginal AND 
$not Inverts the effect of a query expression
 $nor Join query clauses with a logical NOR
 $exists Matches documents that have a specified field

Update Operations

• db.collection_name.insert(<document> ) 
• Omit the _id field to have MongoDB generate a unique key
 • Example db.parts.insert( {{type: “screwdriver”, quantity: 15 } )
 • db.parts.insert({_id: 10, type: “hammer”, quantity: 1 }) 
• db.collection_name.save( <document>)
 • Updates an existing record or creates a new record
 • db.collection_name.update(<query> ,<update> , { upsert: true } )
 • Will update 1 or more records in a collection satisfying query 
• db.collection_name.findAndModify(<query>,<sort> ,<update> ,<new>,<field> ,<upsert>) 
• Modify existing record(s) – retrieve old or new version of the record

Delete Operations

• db.collection_name.remove(<query>,<justone> ) 
• Delete all records from a collection or matching a criterion
 • <justone> specifies to delete only 1 record matching the criterion • Example: db.parts.remove(type: /^h/ } ) - remove all parts starting with h • Db.parts.remove() – delete all documents in the parts collections


Stop mongod Processes

In a clean shutdown a mongod completes all pending operations, flushes all data to data files, and closes  all data files. Other shutdowns are unclean and can compromise the validity of the data files.
To ensure a clean shutdown, always shutdown mongod instances using one of the following methods:
Use shutdownServer()
Shut down the mongod from the mongo shell using the db.shutdownServer() method as follows:
use admin
db.shutdownServer()
Use --shutdown
From the Linux command line, shut down the mongod using the --shutdown option in the following command:
mongod --shutdown

Top Answers to MongoDB Interview Questions

1. Compare MongoDB and Cassandra
CriteriaMongoDBCassandra
Data ModelDocumentBig Table like
Database scalabilityReadWrite
Querying of dataMulti-indexedUsing Key or Scan

2. What makes MongoDB the best?
MongoDB is considered to be best NoSQL database because of :Document-oriented (DO)
High performance (HP)
High availability (HA)
Easy scalability
Rich query language
3. How to do transactions/locking in MongoDB?
MongoDB does not use conventional locking with reduction, as it is planned to be light, high-speed and knowable in its presentation. It can be considered as parallel to the MySQL MyISAM auto entrust sculpt. With simplest business sustain, performance is enhanced, particularly in a structure with numerous servers.
4. When and to what extent does Data get extended to Multi-slice?
The MongoDB scrap stands on a collection. So an album of all substances is kept in a lump or mass. Only when there is an additional time slot, there will be more than a few slice data achievement choices, but when there is more than 1 lump, data gets extended to a lot of slices and it can be extended to 64 MB.
5. Judge against MongoDB with Couchbase and CouchbaseDB?
Although Mongo DB with Couchbase and Couchbase DB are common in many ways, but still they are different in the case of necessities for execution of the model, crossing points, storage, duplications, etc.
6. When do we use Namespace in MongoDB?
During sequencing of the names of the database and collection name Namespace is used.
7. If you remove an object attribute, is it deleted from the database?
Yes, it is deleted. So better eliminate the attribute and then save the object again.
8. How can we move the old file in the moveChunk directory?
Once the functions are done, the old files are converted to backup files and moved to the moveChunk directory at the time of balancing the slices.
9. Explain the situation when an index does not fit into RAM?
When an index is too huge to fit into RAM, then MongoDB reads the index, which is faster than reading RAM because the indexes easily fit into RAM if the server has got RAM for indexes along with the remaining set.
10. How does MongoDB provide consistency?
MongoDB uses the reader-writer locks, allowing simultaneous readers to access any supply like a database or any collection. But always offers private access to singles writes.
11. Why is MongoDB not chosen for a 32-bit system?
Mongo DB is not considered as a 32-bit system because for running the 32-bit MongoDB, with the server, information and indexes require 2 GB. So only it is not used in 32-bit devices.
12. How does Journaling work in MongoDB?
Write operations are saved in the memory while journaling is going on. The on-disk journal files are really dependable for the reason that the journal writes are habitual. Inside dbPath, a journal subdirectory is designed by MongoDB.
13. How can you isolate our cursors from intervening with the write operations?
Snapshot () method is used to isolate cursors from intervening with writes. This method negotiates the index and makes sure that each query comes to any article only once.
14. Define MongoDB.
It is document oriented database which is used to high availability, easy scalability and high performance. It supports the dynamic schema design.
15. Explain replica set.
It is a group of mongo instances that maintain same data set. Replica sets provide redundancy and high availability, and are the basis for all production deployments.
16. What are the key features of mongodb?
There are 3 main features of mongodb that are automatic scaling, High performance and high availability.
17. What is CRUD?
Mongodb provides CRUD operations that are create, Read, Update, Delete.
To learn more about MongoDB CRUD operations click here.
18. What is sharding?
Sharding means to store the data on the multiple machines.
19. What is Aggregation in MongoDB?
Aggregations are operations that process data records and return computed results.
20. Define the namespace in mongodb?
It is the concatenation of collection name and database.
21. Which syntax is used to create collection in mongodb?
db.createCollection(name,options) is used to create collection in mongodb.
Download MongoDB Interview Questions asked by top MNCs in 2018
GET PDF
22. Which syntax is used to drop collection in mongodb?
db.collection.drop() is used to drop collection in mongodb.
23. Explain Replication.
Replication is the process of synchronizing data across multiple servers.
24. What is the use of Index in mongodb?
Indexes provide high performance read operations for frequently used queries.
25. Which command is used for inserting a document?
database.collection.insert (document) is used for inserting a document.
26. What is use of GridFS in mongodb?
GridFS is used for storing and retrieving the large files like audio, Images, Video files.
27. What is the use journaling?
Journaling is used to safe backups in mongodb.
28. Which command is used to see the connection?
db_adminCommand (“connPoolStats”); is used to see the connection.
29. Define primary replica sets?
The primary replica set accepts all write operations from clients.
30. Define secondary replica sets.
The secondaries (page 565) replicate the primary’s oplog and apply the operations to their data sets such that the secondaries’ data sets reflect the primary’s data set.
31. What is the use of profiler?
Profiler is used to show the performance characteristics of every operation against the database.
32. Which type of data mongodb store?
MongoDB stores data in the form of documents, which are JSON-like field and value pairs.
33. What is purpose of replication?
Replication provides redundancy and increases data availability.
34. what is embedded documents?
Embedded documents capture relationships between data by storing related data in a single document structure.
35. Define application level encryption.
Application Level Encryption provides encryption on a per-field or per-document basis within the application layer.
36. What is storage encryption?
Storage Encryption encrypts all MongoDB data on the storage or operating system to ensure that only authorized processes can access protected data.
37. Which method is used to create an index?
CreateIndex() method is used to create an index.
Click here to learn more about index creation in MongoBD.
38. What is replica set oplog?
The oplog records all operations that modify the data in the replica set.
39. What is vertical scaling?
Vertical scaling adds more CPU and storage resources to increase capacity.
40. Define horizontal scaling.
It divides the data set and distributes the data over multiple servers, or shards.
41. What are the components of shared cluster?
Sharded cluster has the following components: shards, query routers and config servers.
42. Which command is use to create database?
DATABASE_NAME command is used to create database.
43. Which command is use to drop database?
db.dropDatabse() command is used to drop the database.
44. What is the use of pretty() method?
Pretty() method is used to show the results in a formatted way.
45. Which method is used to remove the document form the collection?
Remove() method is used to remove the document form the collection.
46. Define Mongodb projection.
Projection is used to select only necessary data.It did not select whole data of a document.
47. What is the use of limit() method?
Limit() method is used to limit the records in database.
48. What is the syntax of limit() method?
>db.COLLECTION_NAME.find().limit(NUMBER) syntax is used.
49. What is the syntax of sort() method?
>db.COLLECTION_NAME.find().sort({KEY:1}) syntax is used for sorting the documents.
50. Which command is used to create the backup of database?
Mongodump command is used to create the backup of database.
51. What is collection in monodb?
In monogodb collection is a group of mongodb documents.
52. What is the use of db command?
Db command gives the name of currently selected database.
53. Which method is used to update the documents into a collection?
Update() and save() methods are used to update the documents into a collection.
54. What is the syntax of skip() method?
The syntax of skip methopd is >db.COLLECTION_NAME.find().limit(NUMBER).skip(NUMBER).
55. Which command is used to restore the backup?
Mongorestore command is used to restore the backup.
56. What is the use of Dot notation in mogodb?
MongoDB uses the dot notation to access the elements of an array and to access the fields of an embedded document.
57. Define auditing.
Auditing provides administrators with the ability to verify that the implemented security policies are controlling activity in the system.
58. Define Aggregation Pipeline.
It is a framework for performing aggregation tasks.T he pipeline is used to transform the documents into aggregated results.
59. Define Map reduce.
Map-reduce is a generic multi-phase data aggregation modality which is used for processing quantities of data.
60. What is splitting in mongodb?
It is a background process that is used to keep chunks from growing too large.
61. Which language is used to wite mongodb?
C++ language is used for writing and implementing mongodb.
62. In which format mongodb stores the data?
Mongodb uses collection to store the data rather than in table.
63. What is the use of save() method?
Save() method is used to replace the existing document to the new document.
64. What is MongoDB?
MongoDB (from humongous) is a cross-platform document-oriented database. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), making the integration of data in certain types of applications easier and faster. Released under a combination of the GNU Affero General Public License and the Apache License, MongoDB is free and open-source software.
First developed by the software company 10gen (now MongoDB Inc.) in October 2007 as a component of a planned platform as a service product, the company shifted to an open source development model in 2009, with 10gen offering commercial support and other services. Since then, MongoDB has been adopted as backend software by a number of major websites and services, including Craigslist, eBay, Foursquare, SourceForge, Viacom, and the New York Times, among others. MongoDB is the most popular NoSQL database system.
Check this blog for better understanding of MongoDB.
65. What is the use of MongoDB?
MongoDB is relational database management system (RDBMS) replacement for web applications. So when you have something which is close to RDBMS, MongoDB could be of good use. It gives you that additional partition tolerance which RDMBS doesn’t give but it has problems with availability. But if you want more scalability, MongoDB would be your choice.
It’s suitable for real-time analytics and high speed logging. It’s highly scalable as well. Craigslist uses MongoDB for archived posts.
Click here, learn more about online MongoDB Training course.
66. What do you understand by NoSQL databases? Is MongoDB a NoSQL database? Explain.
At the present time, the internet is loaded with big data, big users, big complexity etc. and also becoming more complex day by day. NoSQL is answer of all these problems; it is not a traditional database management system, not even a relational database management system (RDBMS). NoSQL stands for “Not Only SQL”. NoSQL is a type of database that can handle and sort all type of unstructured, messy and complicated data. It is just a new way to think about the database.Yes. MongoDB is a NoSQL database.
67. What type of DBMS is MongoDB?
MongoDB is a document oriented DBMS>
68. What is the difference between MongoDB and MySQL?
Although MongoDB and MySQL both are free and open source databases, there is a lot of difference between them in the term of data representation, relationship, transaction, querying data, schema design and definition, performance speed, normalization and many more. To compare MySQL with MongoDB is like a comparison between Relational and Non-relational databases.
69. What is the use of MongoDB?
  •  MongoDB is typically used as the primary data store for operational applications with real-time requirements (i.e., low-latency, high availability). MongoDB is generally a good fit for 60%-80% of the applications you may be building today. MongoDB is easy to operate and scale in ways that are hard if not impossible with relational databases.
  • MongoDB excels in many use cases where relational databases aren’t a good fit, like applications with unstructured, semi-structured and polymorphic data, as well as applications with large scalability requirements or multi-data center deployments.
  • MongoDB may not be a good fit for some applications. For example, applications that require complex transactions (e.g., a double-entry bookkeeping system) and scan-oriented applications that access large subsets of the data most of the time may not be a good fit for MongoDB. MongoDB is not a drop-in replacement for legacy applications built around the relational data model and SQL.
  • Some common use cases include mobile apps, product catalogs, real-time personalization, content management and applications delivering a single view across multiple systems
70. What kind of database is MongoDB?
MongoDB is a document-oriented DBMS. Think of MySQL but with JSON-like objects comprising the data model, rather than RDBMS tables. Significantly, MongoDB supports neither joins nor transactions. However, it features secondary indexes, an expressive query language, atomic writes on a per-document level, and fully-consistent reads.
Operationally, MongoDB features master-slave replication with automated failover and built-in horizontal scaling via automated range-based partitioning.

71. What language is MongoDB written in?
MongoDB is implemented in C++. Drivers and client libraries are typically written in their respective languages, although some drivers use C extensions for better performance.

72. What are the limitations of 32-bit versions of MongoDB?
MongoDB uses memory-mapped files. When running a 32-bit build of MongoDB, the total storage size for the server, including data and indexes, is 2 gigabytes. For this reason, do not deploy MongoDB to production on 32-bit machines.
If you’re running a 64-bit build of MongoDB, there’s virtually no limit to storage size. For production deployments, 64-bit builds and operating systems are strongly recommended.

73. While creating Schema in MongoDB what are the points need to be taken in consideration?
Points need to be taken in consideration are:
  • Design your schema according to user requirements
  • Combine objects into one document if you use them together. Otherwise, separate them
  •  Do joins while write, and not when it is on read
  • For most frequent use cases optimize your schema
  • Do complex aggregation in the schemaThis blog will help you get a better understanding of Difference Between Cassandra and MongoDB!

5 comments:

  1. Your blog is in a convincing manner, thanks for sharing such an information with lots of your effort and time
    mongodb online training

    ReplyDelete
  2. Python Training in Hyderabad. Python is an interpreted, high-level and general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant whitespace.
    Amazon web services Training in Hyderabad

    Amazon web services Course in Hyderabad

    ReplyDelete
  3. DevOps Training in Hyderabad .DevOps is a software engineering practice that aims at unifying software development and software operation. Spend more time on the code that matters and less on the tasks that slow your developers down.
    DevOps Training in Hyderabad

    DevOps Course in Hyderabad

    ReplyDelete