Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MongoDB Interview Questions:
- What are some advantages of MongoDB?
- - Supports field, range-based, and string pattern matching queries
- - Primary and secondary index support
- - Uses JavaScript objects instead of procedures
- - Dynamic database schema
- - Easy scalability
- - Built-in support for data partitioning (Sharding)
- What is a Document in MongoDB?
- - Ordered set of keys with associated values
- - Represented as a map, hash, or dictionary
- - Example: {"greeting": "Hello world!", "views": 3}
- What is a Collection in MongoDB?
- - Group of documents
- - Analogous to a table in relational databases
- - Collections have dynamic schemas
- What are Databases in MongoDB?
- - Group collections into databases
- - MongoDB can host several databases
- - Reserved database names include admin, local, config
- What is the Mongo Shell?
- - JavaScript shell for interacting with MongoDB from the command line
- - Used for administrative functions, inspecting instances, and exploring MongoDB
- - Full-featured JavaScript interpreter
- How does Scale-Out occur in MongoDB?
- - Document-oriented model makes it easy to split data across multiple servers
- - MongoDB balances and loads data across a cluster automatically
- - Mongos acts as a query router
- - Config servers store metadata and configuration settings
- What are some features of MongoDB?
- - Indexing support
- - Aggregation framework
- - Special collection and index types (e.g., TTL collections)
- - File storage
- - Sharding for horizontal scaling
- How to add data in MongoDB?
- - Use inserts, insertOne for single document, insertMany for multiple documents
- How do you Update a Document?
- - Use updateOne, updateMany, or replaceOne methods
- - Provide filter document and modifier document for updates
- How do you Delete a Document?
- - Use deleteOne or deleteMany methods
- - Specify a filter document to match against documents to be removed
- How to perform queries in MongoDB?
- - Use the find method
- - Query criteria specified by a document
- What are the data types in MongoDB?
- - Null
- - Boolean
- - Number
- - String
- - Date
- - Regular expression
- - Array
- - Embedded document
- - Object ID
- - Binary data
- - Code
- When to use MongoDB?
- - Rapid iterative development
- - Scaling to high levels of read and write traffic
- - Scaling data repository to a massive size
- - Evolving deployment as business changes
- - Storing, managing, and searching data with various dimensions
- How is Querying done in MongoDB?
- - Use the find method
- - Query criteria specified by a document
- Explain the term “Indexing” in MongoDB.
- - Indexes help efficiently resolve queries
- - Stores a small part of the data set in an easily traversable form
- - Create indexes using createIndex method
- What are Geospatial Indexes in MongoDB?
- - Two types: 2dsphere and 2d
- - 2dsphere for spherical geometries based on the WGS84 datum
- - 2d for points on a two-dimensional plane
- Explain the process of Sharding.
- - Splitting data across machines
- - Create a cluster of many machines (shards) and break up a collection across them
- - Each shard stores a subset of data
- Explain the SET Modifier in MongoDB?
- - Sets the value of a field if it doesn't exist
- - Useful for updating schemas or adding user-defined keys
- What do you mean by Transactions?
- - Logical unit of processing including one or more database operations
- - Ensures consistency in MongoDB
- - Core API or Call-back API can be used
- What are MongoDB Charts?
- - Integrated tool for data visualization in MongoDB
- - Offers a way to create visualizations using data from a MongoDB database
- - Two implementations: MongoDB Charts PaaS and MongoDB Charts Server
- What is the Aggregation Framework in MongoDB?
- - Set of analytics tools for performing analytics on documents
- - Based on the concept of a pipeline
- - Documents pass through stages, each performing a different operation
- Explain the concept of pipeline in the MongoDB aggregation framework.
- - Individual stage of data processing unit
- - Processes documents one at a time and produces output stream
- - Documents pass through stages sequentially
- What is a Replica Set in MongoDB?
- - Group of servers with one primary and multiple secondaries
- - Primary receives write operations, secondaries keep copies of primary's data
- - Ensures high availability and data safety
- Explain the Replication Architecture in MongoDB.
- - Primary receives write operations and saves data changes in the Oplog
- - Secondaries query primary for new changes in the Oplog and copy them
- - Changes applied from Oplog to secondaries' datafiles
- What are some utilities for backup and restore in MongoDB?
- - mongoimport
- - mongoexport
- - mongodump
- - mongorestore
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement