Sobes.tech
Junior — Middle

Share your experience working with NoSQL databases or non-relational data storage systems

sobes.tech AI

Answer from AI

In working with NoSQL databases, I have used MongoDB and Redis, which are well-suited for storing unstructured or semi-structured data.

My experience includes:

  • MongoDB: Used for storing JSON-like documents, which is convenient for dynamic schemas. Applied aggregation functions for complex queries, indexing to speed up retrievals.

  • Redis: Used as an in-memory store for caching and session management, thanks to its high access speed.

In Node.js, interaction with NoSQL databases usually occurs through official drivers or ORM/ODM, such as Mongoose for MongoDB.

Example of connecting to MongoDB using Mongoose:

const mongoose = require('mongoose');

mongoose.connect('mongodb://localhost/mydb', { useNewUrlParser: true, useUnifiedTopology: true })
  .then(() => console.log('Connected to MongoDB'))
  .catch(err => console.error('Connection error', err));

const userSchema = new mongoose.Schema({
  name: String,
  email: String
});

const User = mongoose.model('User', userSchema);

// Creating a new user
const user = new User({ name: 'Ivan', email: 'ivan@example.com' });
user.save();

This approach allows flexible data handling and application scaling.

Share your experience working with NoSQL databases or… - sobes.tech