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
203 questions
0
votes
1
answer
164
views
Reorganize data with pattern while migrating from SQL to MongoDB
I have several tables in Oracle, in each of them are stored data about a different kind of tax declaration (house tax, hotel tax, and so on). All of them have some data in common, so I want to migrate ...
0
votes
1
answer
71
views
Best practice for how to structure documents in a MongoDB time series collection?
I want to store some measurement readings from devices in a mongodb time series collection.
Let's say that a device sends one or more measurement readings in each message so a message would look ...
0
votes
1
answer
925
views
MongoDB schema: optional vs. nullable
If I have a schema that includes fields that may or may not be set, what is the best way to handle these fields? Should they be optional or instead nullable?
Here an example (Mongoose/NestJs)
@Schema()...
-1
votes
1
answer
67
views
Implementing a selectable requirements with level of advancement in a web app [closed]
I'm doing a project to teach myself more about MongoDB and ASP.NET development and I am stuck. The project is a mockup of a JobBoard website, where Companies would post offers for potential Employees.
...
1
vote
4
answers
1k
views
Microservices distributed lock mechanism
I am using spring boot with mongo db (azure cosmos db) in my microservices. Currently I have an Orders collection that stores Orders. These documents have a field userId that is null when the document ...
-2
votes
1
answer
798
views
How to create Business rule engine in PostgreSQL? [closed]
Our organization is into Health Care RCM business. In that, we use to receive medical records (called as accounts, which is a business phrase) and our staff (Medical coders) use to do medical coding, ...
1
vote
0
answers
44
views
Optimised MongoDB design for access control at project/organisation level
I'm looking for the optimised approach of designing MongoDB database collections where there are three stakeholders-
A User (who accesses a portal).
An Organization (which can have multiple Projects)....
1
vote
2
answers
5k
views
When to use an array of objects or an object of objects in MongoDB Design?
I have a question about the general guidance of how to properly mongodb design:
Scenario: I have many collection of objects, all uniquely identified by their contract_address, and i want to be able to ...
1
vote
1
answer
150
views
Aggregating embedded documents in MongoDB
I'm designing a mongo database and I have a dilemma if I should go for normalization.
Let's say that there is a database with images and descriptions. Many alternative descriptions can belong to one ...
2
votes
1
answer
3k
views
How to scale transactional outbox pattern with document database?
I'm trying to understand CQRS, DDD by writing a small pet project which is somewhat similar to this great repo.
I've come across Transactional Outbox pattern and as imo it was correctly pointed out in ...
1
vote
1
answer
2k
views
Difference between Resolvers and Controllers?
I may be overthinking it, but are controllers and resolvers the same thing in web applications? Coming from the MERN stack, everyone used to call these request processing functions "controllers,&...
0
votes
1
answer
286
views
Mixing static referred and dynamic data in database
I’m making an inventory for a game using nosql (mongo). I made some ItemType records (contains common data like icon, name, weight) and some ItemInstance records (representing specific items, ...
1
vote
1
answer
149
views
What's the difference between MongoDB Query API and MondoDB Query Language?
So I've been trying to understand the difference between MongoDB's Query API and its Query Language but I haven't been able to find a definitive answer.
I've been reading the MongoDB Docs and it is ...
1
vote
1
answer
496
views
How to represent NoSQL entities
I've mainly studied SQL structures, and I know that the representation of the entities can look something like this:
However, I'm building this app with MongoDB, so NoSQL DB. I'm aware that MongoDB ...
0
votes
1
answer
480
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-...
-3
votes
1
answer
209
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 ...
0
votes
0
answers
44
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 ...
0
votes
1
answer
169
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 "...
2
votes
2
answers
2k
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:
...
0
votes
0
answers
110
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: {...
0
votes
2
answers
327
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 ...
-2
votes
2
answers
1k
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 ...
-3
votes
1
answer
136
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 ...
0
votes
0
answers
83
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 ...
1
vote
5
answers
582
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 ...
0
votes
1
answer
670
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 ...
-2
votes
2
answers
1k
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 ...
2
votes
1
answer
70
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 ...
0
votes
0
answers
375
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)
{
...
1
vote
3
answers
286
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 ...
2
votes
1
answer
154
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 /...
0
votes
1
answer
65
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 ...
1
vote
0
answers
70
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 ...
0
votes
1
answer
72
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 ...
2
votes
2
answers
905
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 ...
0
votes
0
answers
51
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 ...
3
votes
3
answers
2k
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 ...
2
votes
2
answers
236
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": ...
-3
votes
1
answer
173
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 ...
0
votes
0
answers
236
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 ...
1
vote
0
answers
206
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":...
4
votes
1
answer
742
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 ...
3
votes
1
answer
185
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 ...
1
vote
0
answers
5k
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 ...
0
votes
1
answer
259
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 ...
-1
votes
1
answer
486
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 ...
-3
votes
2
answers
103
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 ...
0
votes
0
answers
42
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'...
1
vote
2
answers
317
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 ...
2
votes
2
answers
5k
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 ...