Questions tagged [mongodb]

MongoDB is a scalable, high-performance, open source, document-oriented database. It supports a large number of languages and application development platforms. Questions about administrating it can be asked on dba.stackexchange.com

Filter by
Sorted by
Tagged with
-3 votes
0 answers
25 views

Structuring a database for an investment portfolio?

would really appreciate some general advice on the structure of an app i'm building. I'm essentially trying to re-create an investment portfolio app using a MERN stack. Something very similar to ...
user avatar
0 votes
1 answer
36 views

Store UUID Reference vs. storing string in Mongodb

I am trying to store user preference for notifications. One way to do is store types of notification in separate collection and store UUID of that notification type in user table. e.g. notification-...
user avatar
-3 votes
1 answer
45 views

Ways & Methods switch between MongoDB Database after selecting a country. (MERNG)

I have a concept in which a user selects a country, which will either filter or go to that database; I was thinking of alternatives or options that would help in the process. These are my first plans ...
user avatar
0 votes
0 answers
20 views

How to create multiple change streams dynamically based on connected user and emits different streams to different user.?

I am creating a IOT dashboard application where sensors' data are getting updated in real time. I use socket IO and Mongo db change stream to achieve this so far. I have a dedicated data base "...
user avatar
0 votes
0 answers
38 views

Query for each doucment or include IDs in document itself and query for all documents with ID?

I am working on a project where there will be different kinds of accounts that use Auth0 for auth and authz. I want to have it so that an account will query my backend to get back documents that ...
user avatar
  • 161
0 votes
1 answer
60 views

Right way to combine data between Mongo and DynamoDB

I am looking for a way of dealing with the following situation: 1- Have an items collection in MongoDB 2- Have a users collection in DynamoDB 3- Each document in the items collection has a "...
user avatar
  • 3
2 votes
2 answers
604 views

What is the advantage of Kafka connector to MongoDB over using MongoDB change streams?

I need to stream changes from my MongoDB instance to Elasticsearch. I also need to perform complex transformations on changed documents. After doing some research I narrowed my options down to 2: ...
user avatar
  • 145
0 votes
0 answers
28 views

Storing common data across tenants in NoSQL databases like mongoDB

We are designing a multi-tenant architecture. In our multi-tenant architecture, there are different email templates that are shared across all the tenants. Email template looks like subject: {...
user avatar
0 votes
2 answers
117 views

Saving & Referencing different Schema Types in MongoDB (e.g. for a CMS with Building Blocks)

Say I wanted to build my own CMS system and store data in MongoDB. I would like to have a Collection called BlogArticle. Each article can have a different structure, but will be put together by the ...
user avatar
-2 votes
2 answers
300 views

How to best manage multilingual information in documents in JSON/MongoDB/Mongoose?

I have to manage multilingual information in JSON documents in a MongoDB/Mongoose context. But I'm in a dilemma regarding best the format to use with a view to performance metrics: I'm currently ...
user avatar
-3 votes
1 answer
105 views

How do I evaluate if a data warehouse is necessary?

I need to put data from MongoDB together with tracking data from a quiz app (stuff like which users clicked what button etc). Then I’ll use this in machine learning. I looked at all the DW options ...
user avatar
0 votes
0 answers
56 views

Redis or MongoDB in Memory

I am working on processing of documents and storing their hash in Redis to identify duplicate records and some system files. Recently we migrated to MongoDB from SQL Server as our primary database. So ...
user avatar
1 vote
5 answers
223 views

OOP applications and Databases

I am having such a hard time with OOP and databases. Both in C++ with SQL and even more so with Node.js and MongoDB. For this question I will use Node/Mongo. Let's say we have a user object. Over time ...
user avatar
0 votes
1 answer
314 views

Spring Boot + MongoDB project structure and database creation

I'm planning to start a new Spring Boot project with MongoDB. I'm very familiar with Spring Boot, but all of my past projects used MySQL. Each of my projects has the following directory, that holds ...
user avatar
  • 103
-2 votes
2 answers
72 views

What's better, using DB or Storage services to save videos?

I am creating a website that allows to teachers to uploading courses, what's better, to just use the DB or should I use storage services, and how could I know the size of the videos? I am using AWS if ...
user avatar
2 votes
1 answer
44 views

Need advice on approach for IOT project

I need some advice on an IOT project I am working on. Here are some details about what I am trying to do: Use Case: Periodically receive data from the 3rd party vendor API in real time and allow users ...
user avatar
0 votes
0 answers
166 views

Storing tree data in a database for fast reading of the whole hierarchy

I have a class that looks something like this: class Entity { public string Id { get; set; } public List<Entity> Children { get; set; } public void DoStuff(Data data) { ...
user avatar
  • 109
1 vote
3 answers
99 views

Which of these model error handling strategies makes most sense?

I am building an API in expressjs and, currently, mongo/mongoose. I currently have some model methods that return true or false, some that return a value or false, and some that return a value or ...
user avatar
2 votes
1 answer
77 views

eCommerce category path - names vs IDs

I am building an eCommerce website and there is a Category table in my MongoDB database which has a field called path. This field is used to store category hierarchy e.g Boots category will have /...
user avatar
  • 129
0 votes
1 answer
47 views

System design to store pieces of data with specific ttyl to then refetch

I have a system which generates pieces of data that needs to be tracked and assigned a specific TTYL value (a value in seconds) for how long they are supposed to live before being re-processed. I ...
user avatar
1 vote
0 answers
47 views

Stuck on approach on how to serve a lot of data to users with a lot of possible combinations

So, I'm making an application which monitors specific things that happen within the area of a user. And I'm really stuck at the approach on how to serve specific real-time data to my users. I am using ...
user avatar
  • 119
0 votes
1 answer
52 views

What is the schema to specify relationships in a flat-document structure?

I have a question about the best database schema to do this. So, we want our database schema to carry out some generic operation <> involving two units of data, x1 and x2 (e.g. a1). // CURRENT ...
user avatar
2 votes
2 answers
262 views

Isn't data migration a major benefit of MongoDB compared to the commonly used relational databases?

I was reading an old answer which was recently updated, and noticed that the author doesn't quote the simplicity of data migration as a benefit of MongoDB. I always thought that the major benefit of a ...
user avatar
0 votes
0 answers
33 views

Filtering data from elastic search based on mongodb

I've a list of items in my ElasticSearch. User enters a query and I fetch the results from elastic search. Now, I've a requirement where I don't want to show the user the items which he has already ...
user avatar
2 votes
3 answers
498 views

Is it necessary to run tests in all environments?

In our project, we have DEV, STG and PRD environments that are configured to mirror each other (especially STG and PRD). We have unit tests that we run on DEV and, if they pass, are moved to STG when ...
user avatar
  • 189
1 vote
2 answers
193 views

Ease testing with complex setup scenarios

Within our codebase we have integration tests like these: func TestActivateSuspendedFoo() { // setup all dependencies baz := jsonToStruct( "baz": { "a": ...
user avatar
-3 votes
1 answer
55 views

Do I need MongoDB (or another type of database) to authenticate with Google?

I'm creating a web application using Node.js and Pug, and have recently been looking at adding external OAuth authentication to this site, using Express and Passport.js. I've found a lot of examples ...
user avatar
  • 113
0 votes
0 answers
96 views

Creating group/application/user permissions around mongodb documents

I'm trying to find a good way to manage permissions for a high number of mongo documents. What I want to do: Apply group/user/and or application permissions to mongo documents. Idea 1: Use mysql to ...
user avatar
  • 1
1 vote
0 answers
121 views

Combine/Sync Amazon S3 and MongoDB Atlas with Elastic Search

I have many continuously growing (through scrapping) collections in MongoDB Atlas. The documents in each collection follows the following schema: { "source_url": "<some url on the web>", "html":...
user avatar
3 votes
1 answer
313 views

What *really* is the difference between relational and non-relational data?

Here is where I am at right now: I know that relational data, like that found in relational databases like MySQL or Postgres, is relational because there are relations between the tables. That is the ...
user avatar
3 votes
1 answer
53 views

Storing username and password for another site in Node and MongoDB

This is not about storing my user's login details in the app, I already use hash and JWT tokens for that. There is a part of our app where we need to store the login details of the user for another ...
user avatar
1 vote
0 answers
4k views

Spring Data MongoDB: Update document based on multiple identifiers with Composite ID vs. MongoTemplate upsert vs. MongoRepository find & save

I'm wondering for best practices to upsert a document based on two identifiers. @Document(collection = "cars") public class CarEntity { @Id private ObjectId id; private String ...
user avatar
0 votes
1 answer
126 views

How can I store time series data like Google Analytics, Facebook, etc?

I'm thinking about this in terms of a No SQL database, more specifically MongoDB. So, I want to build something like Google Analytics where I will be taking in a ton of data and when it occurs so I ...
user avatar
-1 votes
1 answer
252 views

How to store nested data in efficient way in DB

We have daily 200-300 live projects which receive online traffic from our vendors across all our live projects. We store this data in two different DB (I know this sounds bad, but seemed good at the ...
user avatar
-3 votes
2 answers
86 views

How to scale an application where every read results in a write?

So I am trying to design a simple URL shortener application where every time a URL is queried, it is going to update the number of times it has been queried. I'm thinking of using MongoDB and I am ...
user avatar
  • 291
0 votes
0 answers
35 views

Recommendations for data clustering in an application

I am making a social media app. I have a use case in which i have to cluster similar type of data. For example, take Instagram. When a user likes a post, we get a notification that 'x likes your post'...
user avatar
1 vote
2 answers
229 views

Dealing with complex uniqueness in MongoDB

I am creating a booking system that will allow users to make a reservations for whole days. When a user wants to initially make a reservation, they select the day(s) and then will have 10 minutes to ...
user avatar
0 votes
2 answers
2k views

Bidirectional sync between two databases with differing schemas

I'm embarking upon a project where the goal is to create a bidirectional sync mechanism between two database systems with differing schemas. One is a custom CRM app build on MongoDB, the other is ...
user avatar
0 votes
0 answers
167 views

Sorting and filtering: ElasticSearch vs MongoDB

This is a problem related to a typical e-commerce requirement. I am using ElasticSearch for all the below use cases. I am confused about whether or not to use MongoDB for the sorting part. I have the ...
user avatar
3 votes
1 answer
367 views

Is it recommended to use schemas on non-relational databases?

I'm trying to figure out if the use of schemas on non-relational schemaless databases like MongoDB is a recommended practice or a bad practice to be avoided. I am doing research work and am looking ...
user avatar
-2 votes
1 answer
57 views

How to safe Consistency in DDD project in single aplication?

I want to design my project in DDD spirit. This is single aplication (not microservices) but with separate BC (as modules). Each BC have separate mongoDB collection. I have problem with communication ...
user avatar
0 votes
2 answers
217 views

How is there no hit in performance with MongoDB's new FLE?

MongoDB recently announced their new field-level-encryption method for helping tackle DB breaches. (https://www.wired.com/story/field-level-encryption-databases-mongobd/) In other articles it is ...
user avatar
-1 votes
1 answer
62 views

Hybrid solution using mysql and mongodb

I am developing a web app that uses a mysql database. I recently encountered some changes that require me to store 3rd party data having an inconsistent schema. I've decided to use mongodb as a ...
user avatar
1 vote
2 answers
412 views

Using a Single Collection for the entire application in MongoDB

It strikes me why most of the sites don't talk about this topic. Recently, I've been doing some extensive research when it comes to NoSQL schema design, and evaluating the different NoSQL options (...
user avatar
  • 275
1 vote
1 answer
43 views

Logging web API POST requests for retry to outside service

My web API talks to an outside service running elsewhere, based on the web API requests (mostly POST). There is a message queue (RabbitMQ) that sits in between them, for request/response from either ...
user avatar
  • 111
-3 votes
1 answer
2k views

What should I test with unit tests for data access layer? (MongoDB)

I'm working in TDD for my data access layer in MongoDB and I don't know what should I test? I think that I shouldn't test if the queries return what they have to return because It's a MongoDB concern....
user avatar
1 vote
0 answers
143 views

On fetching an item does the database read its whole content?

In my database (mongoDB) I have a model called exam and each instance of the modal has a somewhat large json object (500k). I'm using strapi cms to make the query, using graphql plugin. However when ...
user avatar
  • 179
-2 votes
1 answer
173 views

Do I need a redis for caching object while MongoDB already cached frequently accessed items

I'm using mongodb for our web application. Recently I'm think of adding redis for caching objects which usually is the setting/configuration. But the mongodb already cached the frequently accessed ...
user avatar
  • 97
1 vote
1 answer
148 views

MongoDB: Two documents of separate types that reference each other

I'm writing the back-end for a chat application. The database being used is MongoDB, which uses objects that have their own unique IDs. I've run into a problem; I have two document types, channels ...
user avatar
  • 21
1 vote
0 answers
256 views

Refactor MVC to more scalable architecture?

Months ago I began a new web project which, in the beggining, seemed like a small application with virtually few users. I began the project by using the awesome Hackathon Starter WebApp Boilerplate by ...
user avatar