Mangodb

1) Explain what is MongoDB?
Mongo-DB is a document database which provides high performance, high availability and easy scalability.
2) What is “Namespace” in MongoDB?
MongoDB stores BSON (Binary Interchange and Structure Object Notation) objects in the collection. The concatenation of the collection name and database name is called a namespace.
3) What is sharding in MongoDB?
The procedure of storing data records across multiple machines is referred as Sharding. It is a MongoDB approach to meet the demands of data growth. It is the horizontal partition of data in a database or search engine. Each partition is referred as shard or database shard.
4) How can you see the connection used by Mongos?
To see the connection used by Mongos use db_adminCommand (“connPoolStats”);
5) Explain what is a replica set?
A replica set is a group of mongo instances that host the same data set. In replica set, one node is primary, and another is secondary. From primary to the secondary node all data replicates.
6) How replication works in MongoDB?
Across multiple servers, the process of synchronizing data is known as replication. It provides redundancy and increase data availability with multiple copies of data on different database server. Replication helps in protecting the database from the loss of a single server.
7) 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 schema
8) What is the syntax to create a collection and to drop a collection in MongoDB?
  • Syntax to create collection in MongoDB is db.createCollection(name,options)
  • Syntax to drop collection in MongoDB is db.collection.drop()
9) Explain what is the role of profiler in MongoDB?
MongoDB database profiler shows performance characteristics of each operation against the database. You can find queries using the profiler that are slower than they should be.
10) Explain can you move old files in the moveChunk directory?
Yes, it is possible to move old files in the moveChunk directory, during normal shard balancing operations these files are made as backups and can be deleted once the operations are done.
11) To do safe backups what is the feature in MongoDB that you can use?
Journaling is the feature in MongoDB that you can use to do safe backups.
12) Mention what is Objecld composed of?
Objectld is composed of
  • Timestamp
  • Client machine ID
  • Client process ID
  • 3 byte incremented counter
13) Mention what is the command syntax for inserting a document?
For inserting a document command syntax is database.collection.insert (document).
14) Mention how you can inspect the source code of a function?
To inspect a source code of a function, without any parentheses, the function must be invoked.
15) What is the command syntax that tells you whether you are on the master server or not? And how many master does MongoDB allow?
Command syntax Db.isMaster() will tell you whether you are on the master server or not. MongoDB allows only one master server, while couchDB allows multiple masters.
16) Mention the command syntax that is used to view Mongo is using the link?
The command syntax that is used to view mongo is using the link is db._adminCommand(“connPoolStats.”)
17) Explain what are indexes in MongoDB?
Indexes are special structures in MongoDB, which stores a small portion of the data set in an easy to traverse form. Ordered by the value of the field specified in the index, the index stores the value of a specific field or set of fields.
18) Mention what is the basic syntax to use index in MongoDB?
The basic syntax to use in MongoDB is >db.COLLECTION_NAME.ensureIndex ( {KEY:1} ). In here the key is the the name of the COLUMN (or KEY:VALUE pair) which is present in the documents.
19) Explain what is GridFS in MongoDB?
For storing and retrieving large files such as images, video files and audio files GridFS is used. By default, it uses two files fs.files and fs.chunks to store the file’s metadata and the chunks.
20) What are alternatives to MongoDB?
Cassandra, CouchDB, Redis, Riak, Hbase are a few good alternatives.

Compare MongoDB and Cassandra
CriteriaMongoDBCassandra
Data ModelDocumentBig Table like
Database scalabilityReadWrite
Querying of dataMulti-indexedUsing Key or Scan
Read this blog to learn about the comparison of MongoDB & Cassandra.
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.
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.
To learn more about MongoDB check this tutorial page.
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.
Interested to know about MongoDB online training course? Click here.
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!
This blog will help you get a better understanding of the difference between Cassandra and MongoDB!

5 comments:

  1. This is also a very good post which I really enjoyed reading. It is not every day that I have the possibility to see something like this..
    AI Course in Malaysia
    AI Course
    AI Courses
    Artificial intelligence course in malaysia

    ReplyDelete
  2. Good. I am really impressed with your writing talents and also with the layout on your weblog. Appreciate, Is this a paid subject matter or did you customize it yourself? Either way keep up the nice quality writing, it is rare to peer a nice weblog like this one nowadays. Thank you, check also virtual edge and short professional bio template

    ReplyDelete