Interview Questions About MongoDB
Interview Questions About MongoDB
• C – Create: db.collection.insert();
• R – Read: db.collection.find();
• U – Update: db.collection.update();
• D – Delete: db.collection.remove({“fieldname” : ”value”});
3.What is objectId ?
Ans: ObjectId is a class that is the default primary key for the document in
MongoDB. It is found in the _id field of the inserted document. ObjectID is a 12-
byte BSON type. These are:
4.What’s a NoSQL Database, What Types Are There, and What Type Is
MongoDB?
Ans: A NoSQL database offers a mechanism for storage and retrieval of data
meant to respond to the unique demands and challenges of today’s modern
applications. NoSQL, which stands for “Not Only SQL” is a departure from the
tabular relations used in relational databases such as SQL and Oracle. Types of
NoSQL databases: a)Document-oriented b)Key-Value Stores c)Graph Stores
d)Wide-Column Stores. MongoDB is the first type, a document-oriented database,
storing data in Binary JSON (BSON) structure-based documents, which in turn are
stored in a collection.
5. What is the difference between MongoDB and MySQL?
Ans: 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