Skip to content

Latest commit

 

History

History
40 lines (33 loc) · 5.06 KB

0.Extra.md

File metadata and controls

40 lines (33 loc) · 5.06 KB

Extras

Q. Difference between relational, object-oriented, nosql, hierarchical DB

Feature Relational Database Object-Oriented Database NoSQL Database Hierarchical Database
Data Model Tables with rows and columns Objects, classes, inheritance Key-Value, Document, Column, Graph Tree structure with parent-child relationships
Schema Fixed schema Schema follows object classes Flexible schema Rigid schema
Query Language SQL Object Query Language (OQL) Varies (e.g., MongoDB uses MQL) None (typically uses path queries)
Data Storage Rows in tables Objects Varies (e.g., JSON, BSON, etc.) Hierarchical structure with linked nodes
Scalability Vertical scaling Vertical scaling Horizontal scaling Vertical scaling
ACID Compliance Strong ACID properties Supports ACID Varies (often BASE over ACID) Strong ACID properties
Relationships Foreign keys, joins Direct references via objects Denormalized, typically no joins Parent-child relationships
Examples MySQL, PostgreSQL, Oracle db4o, ObjectDB MongoDB, Cassandra, DynamoDB IBM Information Management System (IMS)
Use Cases Traditional applications, ERP, CRM CAD, telecommunications, complex data models Big data, real-time web apps, flexible data models Legacy systems, hierarchical data like XML or LDAP
Advantages Maturity, standardization, strong consistency Aligns with OOP, seamless integration with object-oriented languages Flexibility, scalability, performance Simple model, fast data retrieval for specific use cases
Disadvantages Rigid schema, scaling limitations Complexity, less maturity than RDBMS Potential consistency issues, varied tooling Rigid structure, inflexible for complex queries

Difference between Relational and NoSQL

Relational NoSQL
Has strict schema/structure Schemaless
Row-column format JSON format
Predictable Data Difficult to predict data
Performance issues while reading with large set of data and relationships Better at reading from large data set as it supports complex nested structure.
MySQL, Postgres, SQL Server MongoDB, DynamoDB, CouchDB

Difference between MongoClient.connect(url) vs mongoose.connect(url)

Feature/Aspect MongoClient.connect(url) mongoose.connect(url)
Library mongodb Node.js driver Mongoose (ODM library for MongoDB and Node.js)
Abstraction Level Low (direct interface to MongoDB) High (provides schema-based data modeling)
Typical Use Case Direct access and control over MongoDB Schema-based data modeling, handling relationships, validation
Pros - Full control over MongoDB operations - Simplifies working with MongoDB using schemas and models
- Suitable for fine-grained control - Built-in data validation, middleware support
Cons - Requires more boilerplate code - Adds abstraction overhead
- Less convenient for complex data models - Might be overkill for basic database operations