1. Explain what is MongoDB? Mongo-DB is a document database which provides high performance, high availability and easy scalability. 2. 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. 3. 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. 4. 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 5. To do safe backups what is the feature in MongoDB that you can use? For the safe backups MongoDB has the feature called Journaling. 6. Mention what is Objectld composed of? Objectld is composed of • Timestamp • Client machine ID • Client process ID • 3 byte incremented counter 7. Mention what is the command syntax for inserting a document? For inserting a document command syntax is database.collection.insert (document). 8. Compare MongoDB and Cassandra MongoDB: • data mode are document • database scalability is read only • query of the data is multi-index Cassandra: • data mode are big table like • database scalability is write only • query of the data is using key or scana 9. when an index does not fit into RAM? index is very huge then index will not fit to RAM. 10. what is meant by CRUD? create read update delete 11. What is sharing in MongoDB? the process of storing the record in multiple Machine is known as sharing. 12. How can you see the connection used by Mongos? By using the mongo command : db_adminCommand (“connPoolStats”); 13. What is the syntax to create a collection? syntax. db.create Collection(name,options) 14. What is the syntax to drop a collection? syntax: db.collection.drop() 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? isMaster() is the syntax for knowning whether you are on master server or not. 16. Mention the command syntax that is used to view Mongo is using the link? Syntax db._adminCommand(“connPoolStats.”) 17. Mention what is the basic syntax to use index in MongoDB? syntax : >db.COLLECTION_NAME.ensureIndex ( {KEY:1} ). 18. What are other alternatives to MongoDB? • Cassandr • CouchDB • Redis • Riak 19. What kind of NoSQL database MongoDB is? It is a document oriented database. 20. How is MongoDB better than other SQL databases? It Permits highly flexible and scalable document structure. Which other sql database does not support such relationships. 21. Does MongoDB need a lot of RAM? it can run on small amount of data because it is dynamic space are allocated and re-allocated. 22. What are all the advantage of MongoDB? • It is a Schema less. • Structure of a single object is clear. • No complex joins. • Easy of scale-out 23. What are the datatypes Mongo DB supports? String, Integer, Boolean, Double, Array, Timestamp, Date, Regular expression 24. How to display all the documents? Syntax to display all documents : Db.dbname.find() 25. What is the purpose of pretty () method? Pretty () method used to display in formatted way. 26. What is the use of limit ()? It will used to limit the value display from the documents. DB.DBNAME.find ().limit (number) 27. What are all the Aggregate function in Mongo DB? Sum, Avg, Min, Max, Push, addToSet, first, last. 28. What is the syntax of sort() method? db.COLLECTION_NAME.find().sort({KEY:1}) 29. What is embedded documents? Embedded documents are received while they were small, given the relations between the related data has been written in one body. 30. The encryption storage? MongoDB encryption encrypts data stored on any storage or processing by operating system may not be able to access protected data. 31. MongoDB equivalent query for the below SQL query – INSERT INTO employee (eid, age, salary) VALUES (763357, 45, 56489.40);? Ans :employee.insert( { eid: 763357, age: 45, salary: 56489.40 } ) 32. What is the result of the below operation?db.electronics.update( {item : “LCD”, quantity : { $gte : 5 } }, { $set : { HD : “full HD” }, $inc : { price : 8000 } } )? This command will updates only first matching document. 33. What would be the result of running the below query? – employee_profiles.deleteOne( {‘unit’: ‘ETA’})? Only the first matching document will be deleted. 34. The aggregation query in MongoDB that will sort the collection with ename field ascending? employee.aggregate( [ { $sort: {ename:1} } ] ) 35. The command that creates an index on the quantity field, descending? inventory.createIndex( { “stock.quantity”:-1 } ) 36. Which are the different languages supported by MongoDB? Ans : MongoDB support for C, C++, C#, Java, Node.js, Perl, PHP, Python, Ruby, Scala, Go and Erlang. 37. Why MongoDB is known as best NoSQL database? MongoDb is the best database then NoSQL database because • Document Oriented • Rich Query language • High Performance • Highly Available • Easily Scalable 38. Does MongoDB support primary-key, foreign-key relationship? No. By Default, MongoDB doesn’t support primary key-foreign key relationship. 39. Can you achieve primary key – foreign key relationships in MongoDB? We can achieve primary key-foreign key relationship by embedding one document inside another. For example: An address document can be embedded inside customer document. 40. What are Indexes in MongoDB? In MondoDB, Indexes are used to execute query efficiently. Without indexes, MongoDB must perform a collection scan, i.e. scan every document in a collection, to select those documents that match the query statement. If an appropriate index exists for a query, MongoDB can use the index to limit the number of documents it must inspect. 41. By default, which index is created by MongoDB for every collection? By default, the_id collection is created for every collection by MongoDB. 42. Why does Profiler use in MongoDB? MongoDB uses a database profiler to perform characteristics of each operation against the database. You can use a profiler to find queries and write operations. 43. which language MongoDB is written? MongoDB is written and implemented in C++. 44. Does MongoDB database have tables for storing records? No. Instead of tables, MongoDB uses “Collections” to store data 45. Why 32 bit version of MongoDB are not preferred ? Because MongoDB uses memory mapped files so when you run a 32-bit build of MongoDB, the total storage size of server is 2 GB. But when you run a 64-bit build of MongoDB, this provides virtually unlimited storage size. So 64-bit is preferred over 32-bit. 46. Explain the covered query in MongoDB. A query is called covered query if satisfies the following two conditions: o The fields used in the query are part of an index used in the query. o The fields returned in the results are in the same index. 47. In which format MongoDB represents document structure? MongoDB uses BSON to represent document structures. 48. Why are MongoDB data files large in size? MongoDB doesn’t follow file system fragmentation and pre allocates data files to reserve space while setting up the server. That’s why MongoDB data files are large in size. 49. What is a storage engine in MongoDB? A storage engine is the part of a database that is used to manage how data is stored on disk. For example: one storage engine might offer better performance for read-heavy workloads, and another might support a higher-throughput for write operations. 50. Which are the storage engines used by MongoDB? MMAPv1 and WiredTiger are two storage engine used by MongoDB. -viraj mhashelkar SRIEIT]]>