Mango DB

{
  "iq":[{"id":"1",
    "q":"Explain what is MongoDB?",
    "answer":"Mongo-DB is a document database which provides high performance, high availability and easy scalability."
  },
    {"id":"2",
      "q":"What is “Namespace” in MongoDB?",
      "answer":"MongoDB stores BSON (Binary Interchange and Structure Object Notation) objects in the collection.\n\nThe concatenation of the collection name and database name is called a namespace.\n\nThe components are prone to work in an unstable way of receiving and processing the requests.\n\nThe buffer creates the equilibrium linking various apparatus and crafts them effort at the identical rate to supply more rapid services."
    },
    {"id":"3",
      "q":"What is sharding in MongoDB?",
      "answer":"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."
    },
    {"id":"4",
      "q":"What are the best features of Mongodb?",

      "answer":"Document-oriented\n\nHigh performance\n\nHigh availability\n\nEasy scalability\n\nRich-query language "
    },
    {"id":"5",
      "q":"What is 32-bit nuances?",
      "answer":"There is an extra memory mapped file activity with journaling. This will further constrain the limited db size of 32-bit builds. For now, journaling by default is disabled on 32-bit systems."
    },
    {"id":"6",
      "q":"Will there be journal replay programs in case of incomplete entries (if there is a failure in the middle of one)?",
      "answer":"Each journal (group) write is consistent and won’t be replayed during recovery unless it is complete."
    },

    {"id":"7",
      "q":"What is the role of profiler in MongoDB?",
      "answer":"MongoDB includes a database profiler which shows performance characteristics of each operation against the database. With this profiler you can find queries (and write operations) which are slower than they should be and use this information for determining when an index is needed.."
    },

    {"id":"8",
      "q":"Explain how replication works in MongoDB?",
      "answer":"Across more servers the process of synchronizing data is called replication.\n\nReplication gives redundancy and growing data availability with more copies of data on different database servers.\n\nIt Provide in protecting the database from the loss of a single server. "
    },
    {"id":"9",
      "q":"How to create Schema in MongoDB and what are the points to be considered?",

      "answer":"There are following points need to be taken into consideration are:\n\nCreating your schema according to client requirements\n\nAdding objects into one document if you use them together. Or separate them\n\nDo joins while to write, and not when it is to read\n\nFor most easily use cases optimize your schema\n\nDo complex aggregation in the Schema."
    },

    {"id":"10",
      "q":"Explain what is the syntax to create a collection and to drop a collection in MongoDB?",
      "answer":"The syntax for creating collection in the MongoDB is db.createCollection(name, options)\n\nThe syntax for drop collection in the MongoDB is db.collection.drop()."
    },

    {"id":"11",
      "q":"Mention how you can  move the old file in the moveChunk directory?",

      "answer":"Yes, of course, to move the old file in the moveChunk directory at the time of shard balancing operations these files are made as backups and can be removed once the operation are done."
    },

    {"id":"12",
      "q":" To do Safe backups what features are used in MongoDB?",
      "answer":"The journaling is the feature in MongoDB that you can use to do safe backups."
    },
    {"id":"13",
      "q":"What is the Object ID composed of in MongoDB?",
      "answer":"Object ID is composed of:\n\n3 bytes incremented counter\n\nClient machine ID\n\nTimestamp\n\nClient process ID"
    },

    {"id":"14",
      "q":"What is the command syntax for inserting a document in MongoDB?",
      "answer":"In MongoDB inserting a document command syntax is database.collcetion.insert(document).."
    },

    {"id":"15",
      "q":" What are the indexes in MongoDB?",
      "answer":"In MongoDB , indexes are special structures,which stores a small portion of the data set in an easy to traverse form.\n\nThe sequence of the value of the field are specified in the index.\n\nAn index stores the value of an individual field or set of fields."
    },

    {"id":"16",
      "q":"What is the basic syntax to use index?",
      "answer":"The basic syntax to use in MongoDB is >db.COLLECTION_NAME.ensureindex ( {KEY:1} ).In this key is the name of the on which you want to make an index, where 1 is for accessing sequence otherwise you use -1 for descending order."
    },

    {"id":"17",
      "q":"Mention what is alternative to MongoDB?   ",
      "answer":"An alternative to MongoDB is Cassandra, HBase, Redis, CouchDB."
    },
    {"id":"18",
      "q":"Explain what is the method to configure the cache size in MongoDB?",
      "answer":"MongoDB’s cache is not configurable. So, MongoDB uses all the free spaces on the system automatically by way of memory mapped files. "
    },

    {"id":"19",
      "q":"Limit MongoDB database size? ",
      "answer":"We’re interested in deploying MongoDB, but we need to know if we can limit database/table sizes?\n\nFor example:\n\ndb.user1.find() db.user2.find()\n\nAs you can see from the above, each user will have their own database. We want to limit each user’s database so we don’t have any one user eating up all our hard drive space."
    },

    {"id":"20",
      "q":"How does Sharding work with replication?",
      "answer":"Each Shard is a logical collection of partitioned data.\n\nThe shard could consist of a single server or a cluster of replicas.\n\nUsing a replica set for each Shard is highly recommended."
    },
    {"id":"21",
      "q":"When will data be on more than one Shard?",
      "answer":"MongoDB Sharding is range-based.\n\nSo all the objects in a collection lie into a chunk.\n\nOnly when there is more than 1 chunk there is an option for multiple Shards to get data.\n\nRight now, the default chunk size is 64mb, so you need at least 64mb for migration."
    },
    {"id":"22",
      "q":" What happens when a document is updated on a chunk that is being migrated? ",
      "answer":"The update will go through immediately on the old Shard and then the change will be replicated to the new Shard before ownership transfers."
    },

    {"id":"23",
      "q":"What happens when a Shard is down or slow when querying?",
      "answer":"If a Shard is down, the query will return an error unless the ‘Partial’ query options is set. If a shard is responding slowly, Mongos will wait for it."
    },{"id":"24",
      "q":"Can the old files in the ‘moveChunk’ directory be removed? ",
      "answer":"Yes, these files are made as backups during normal Shard balancing operations. Once the operations are done then they can be deleted. The clean-up process is currently manual so this needs to be taken care of to free up space."
    },{"id":"25",
      "q":" How do you see the connections used by Mongos?",
      "answer":"The following command needs to be used: db._adminCommand(“connPoolStats”);"
    },{"id":"26",
      "q":" What are the disadvantages of MongoDB?",
      "answer":"A 32-bit edition has 2GB data limit. After that it will corrupt the entire DB, including the existing data. A 64-bit edition won’t suffer from this bug/feature.\n\nDefault installation of MongoDB has asynchronous and batch commits turned on. Meaning, it lies when asked to store something in DB and commits all changes in a batch at a later time in future. If there is a server crash or power failure, all those commits buffered in memory will be lost. This functionality can be disabled, but then it will perform as good as or worse than MySQL.\n\nMongoDB is only ideal for implementing things like analytics/caching where impact of small data loss is negligible.\n\nIn MongoDB, it’s difficult to represent relationships between data so you end up doing that manually by creating another table to represent the relationship between rows in two or more tables."
    },
    {"id":"27",
      "q":"How do you see the connections used by Mongos?",
      "answer":"The following command needs to be used: db._adminCommand(“connPoolStats”);."
    },{"id":"28",
      "q":"What happens when a Shard is down or slow when querying? ",
      "answer":"If a Shard is down, the query will return an error unless the ‘Partial’ query options is set. If a shard is responding slowly, Mongos will wait for it."
    },{"id":"29",
      "q":"Should you start out with Sharded or with a Non-Sharded MongoDB environment?",
      "answer":"We suggest starting with Non-Sharded for simplicity and quick startup, unless your initial data set will not fit on single servers. Upgrading to Sharded from Non-sharded is easy and seamless, so there is not a lot of advantage in setting up Sharding before your data set is large."
    },
    {"id":"30",
      "q":"Which automation gears can help with spinup services?",
      "answer":"The API tools can be used for spinup services and also for the written scripts. Those scripts could be coded in Perl, bash or other languages of your preference. There is one more option that is patterned administration and stipulating tools such as a dummy or improved descendant. A tool called Scalr can also be used and finally we can go with a controlled explanation like a Rightscale."
    },{"id":"31",
      "q":"How the processes start, stop and terminate works? How? ",
      "answer":"Starting and stopping of an instance: If an instance gets stopped or ended, the instance functions a usual power cut and then change over to a clogged position. You can establish the case afterward since all the EBS volumes of Amazon remain attached. If an instance is in stopping state, then you will not get charged for additional instance.\n\nFinishing the instance: If an instance gets terminated it tends to perform a typical blackout, so the EBS volumes which are attached will get removed except the volume’s deleteOnTermination characteristic is set to zero. In such cases, the instance will get removed and cannot set it up afterward."
    },{"id":"32",
      "q":" Explain what are indexes in MongoDB?",
      "answer":"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. "
    },{"id":"33",
      "q":"Mention what is the basic syntax to use index in MongoDB?",
      "answer":"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. "
    },{"id":"34",
      "q":"Explain what is GridFS in MongoDB?",
      "answer":"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."
    },{"id":"35",
      "q":"What type of DBMS is MongoDB?",
      "answer":"MongoDB is a document oriented DBMS."
    },
    {"id":"36",
      "q":" What is the difference between scalability and elasticity?",
      "answer":"Scalability is a characteristic of cloud computing through which increasing workload can be handled by increasing in proportion the amount of resource capacity. It allows the architecture to provide on demand resources if the requirement is being raised by the traffic. Whereas, elasticity is being one of the characteristic provide the concept of commissioning and decommissioning of large amount of resource capacity dynamically. It is measured by the speed by which the resources are coming on demand and the usage of the resources. "
    },
    {"id":"37",
      "q":"What do you understand by NoSQL databases? Is MongoDB a NoSQL database? Explain.",
      "answer":"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."
    },
    {"id":"38",
      "q":"In which format mongodb stores the data?",
      "answer":"Mongodb uses collection to store the data rather than in table. "
    },
    {"id":"39",
      "q":"Which language is used to wite mongodb?",
      "answer":"C++ language is used for writing and implementing mongodb."
    },
    {"id":"40",
      "q":"What is splitting in mongodb?",
      "answer":"It is a background process that is used to keep chunks from growing too large." },

    {"id":"41",
      "q":"Mention how do you use indexes in a collection?",
      "answer":"To list a collection’s index, use the db.collection.getIndexes() method otherwise a similar method based on your driver."
    },{"id": "42",
      "q":"What is GridFS in MongoDB? ",
      "answer":"The GridFS is a specification for storing and retrieving files that precede the BSON-document size limit of 16MB. Rather than storing a file in a single document. The GridFS categorize a file into parts, or chunks and stores each of those chunks as an individual document."
    },{"id":"43",
      "q":"Can you run multiple JavaScript operations in a single MongoDB instance?",
      "answer":"Yes, The V8 JavaScript engine is included in 2.4 which provides multiple JavaScript operations to execute at the same time."
    },{"id":"44",
      "q":"Are null value allowed in MongoDB?",
      "answer":"For members of an object, yes, you cannot include null to a database collection, though a null is not an object. You can add {}, though."
    },
    {"id":"45",
      "q":"What are the NoSQL databases?",
      "answer":"In modern times, the internet is loaded with big data, big users, and big complexity and so on. So, we can say that, MongoDB is  becoming more complex day by day. The MongoDB is not a traditional database management system, not a relational database management system. The full form of NoSQL is Not Only SQL. The NoSQL is a type of database that can handle and sort all types of unstructured, messy and important data."
    },{"id":"46",
      "q":"Mention what are the different types of NoSQL databases?",
      "answer":"There are four types of NoSQL database:\n\nDocument store NoSQL database\n\nGraph base NoSQL database\n\nKey value store NoSQL database\n\nA column store NoSQL database\n\nThere are some other NoSQL databases such as Cassandra, CouchBD, Hybertable, Redis, Riak, Neo4j, HBASE, Couchbase, MemcouchDB, Voldemort, RevenDB and so on."
    },
    {"id":"47",
      "q":"What is the difference between scalability and elasticity?",
      "answer":"Scalability is a characteristic of cloud computing through which increasing workload can be handled by increasing in proportion the amount of resource capacity. It allows the architecture to provide on demand resources if the requirement is being raised by the traffic. Whereas, elasticity is being one of the characteristic provide the concept of commissioning and decommissioning of large amount of resource capacity dynamically. It is measured by the speed by which the resources are coming on demand and the usage of the resources. "
    },
    {"id":"48",
      "q":"Explain why profiler is used in MongoDB?",
      "answer":"The MongoDB uses a database profiler to perform features of each operation against the database. You can also use  a profiler to find issues and write operations."
    },
    {"id":"49",
      "q":" Compare MongoDB with CouchDB and CouchBase?",
      "answer":"The MongoDB and CouchDB are both document oriented databases. In other words MongoDB and CouchDB are the best examples of open source NoSQL database. Besides both storing documents though, it turned out that they are not famous much in common. There is more difference between MongoDB and CouchDB in terms of implementation of their data-model, object store, interface, and replication techniques and so on. "
    },
    {"id":"50",
      "q":"Is an update fsync to disk immediately?",
      "answer":"No, write to disk are lazy by default. A write may hit disk a two seconds later.\n\nFor example, if the database receives a thousand grows into an object within one second,\n\nit will only be flushed into disk once.\n\nNote fsync options are present, though both at the command line and via getLastError_old."
    }
  ]
}