Skip to main content
94 votes

Storing a re-orderable list in a database

Same answer from here https://stackoverflow.com/a/49956113/10608 Solution: make index a string (because strings, in essence, have infinite "arbitrary precision"). Or if you use an int, increment index ...
Alexander Bird's user avatar
15 votes

Storing a re-orderable list in a database

OK I face this tricky problem recently, and all the answers in this Q&A post gave many inspiration. The way I see it, each solution has its pros and cons. If the position field has to be ...
RayLuo's user avatar
  • 751
8 votes

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

First, I’d like to rescope the migration benefit that you attribute to nosql in general to the sole segment of document-stores. Because migrating from anything to a row store, a graph database or a ...
Christophe's user avatar
  • 82.3k
7 votes

Inserting JSON document with `.` in key to MongoDB

There are a few alternatives: 1. Replace dots by a dash. This would be my favorite approach, as it keeps the structure explicit enough. Since according to you, “it is pretty much a one time ...
Arseni Mourzenko's user avatar
7 votes
Accepted

Is it necessary to run tests in all environments?

You create tests to prove that something works correctly, and you re-execute those tests to prove that it still works correctly. For determining if it makes sense to run a particular set of tests in ...
Bart van Ingen Schenau's user avatar
6 votes

How to handle UI updates dependent on slow API responses

You don't have to block the complete UI before the response comes back. You only have to disable the parts of the UI which allow to make another API call before the first one is processed completely (...
Doc Brown's user avatar
  • 221k
6 votes

Implementing tags in object

Short answer It depends on what you intend to do with the tags from an application point of view. If it's just for searching in a single user language, and if the accuracy of the tag is not critical, ...
Christophe's user avatar
  • 82.3k
6 votes

generate unique sequential IDs in microservices architecture

Have the microservice that owns the document creation generate the IDs. Having multiple services all accessing the same data-store directly means that they’re not individually deployable and scalable. ...
Telastyn's user avatar
  • 110k
6 votes
Accepted

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

Both processes' simplicity and complexity have been greatly exaggerated, I'm sure the first one (RDBMS) can be both more complex or simpler, depending on a range of factors. I believe the "every-...
Tulains Córdova's user avatar
5 votes

How to make a basic database application, previously developed for 500 records, ready for 1 million records?

OK, so answering your question literally, You don't need to make any changes. The volume of data on the database isn't usually a scaling issue for webpages. Any given webpage will only be looking at ...
Ewan's user avatar
  • 84.6k
5 votes
Accepted

Should I use NoSQL (MongoDB) or SQL (postgresql) database for my application?

There are plenty of questions to consider when choosing the DBMS technology at the beginning of a project. Here are the first two that come to my mind: How easy can the data be modelled ? How will ...
Christophe's user avatar
  • 82.3k
5 votes
Accepted

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

Schemaless is a misleading term: On one side, a SQL database always has a well-defined schema. This schema is fixed. If you want to put more information in a "record", you'd have to alter the ...
Christophe's user avatar
  • 82.3k
5 votes

Bidirectional sync between two databases with differing schemas

You should not do this. Doing a unidirectional sync is challenging, adds a pile of constraints to your system, but is a fairly well known problem at this point. When you make things bidirectional, ...
Telastyn's user avatar
  • 110k
5 votes
Accepted

Difference between Resolvers and Controllers?

Disclaimer: this is based on what I've read, not on direct personal experience with GraphQL. It looks like the term "resolver" is associated with GraphQL (at least in the context of your ...
Filip Milovanović's user avatar
4 votes
Accepted

MongoDB - Do subdocuments count towards the total size of a document

MongoDb manages json documents in a binary bson format. In particular, bson is used to store documents in the database and exchange the documents with the outside world. Document with embedded/...
Christophe's user avatar
  • 82.3k
4 votes

Storing a re-orderable list in a database

Yes, the question is rather old and already has a couple of answers. Still, all of the solutions offered here are pretty complex. How about some simpler ones? The original question is about Wish List ...
Michal J Figurski's user avatar
4 votes
Accepted

Advice on application architecture using MongoDB for intense multiplayer game

The document storage model does match your requirement as you wont need to look at more than one record at a time. However! I would question whether you need storage at all. If you can send the ...
Ewan's user avatar
  • 84.6k
4 votes

Using a Single Collection for the entire application in MongoDB

Bags Well bags are very easy, you throw everything inside. You don't have to make any upfront decisions. Updating is a breeze, just throw it in, or take it out. Because everything is in the one spot ...
Kain0_0's user avatar
  • 16.6k
4 votes

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

There is no difference between relational and non-relational data. The data is the data. It is a basic aspect of the domain addressed by the application. It does not, or should not, change depending ...
Michael Green's user avatar
4 votes

How to scale transactional outbox pattern with document database?

In this answer I do not dive into MongoDB technology and how to mitigate issues with duplicates manually. I explain what was referenced in the article (Debezium), suggest to use out of the box ...
tecbar's user avatar
  • 41
3 votes

Advice on application architecture using MongoDB for intense multiplayer game

Your plan seems to be to abuse Mongo DB. Mongo DB is a database. Its purpose is to persist data, not to act as central memory (which is your current plan). For what you are describing, you should be ...
TheCatWhisperer's user avatar
3 votes

Find incline of 50% within 30 minutes in a steadily increasing timeseries

I don't really understand why your solution doesn't work, logically it should. However, another option is to go back 3 hours and systematically compare the original point (a) to the point 30 minutes ...
B-Rad's user avatar
  • 31
3 votes

When should we use MongoDB?

MongoDB is great when you can represent your data as independent "packages" of information. You have google maps ZIP codes, embedded in the ZIP code are companies and inside the companies are ...
aarkerio's user avatar
  • 131
3 votes

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

As explained in the links you provided, the encryption/decryption is done on the client side and the server only sees the encrypted values. There is no performance impact on the server, because the ...
Bart van Ingen Schenau's user avatar
3 votes

How to safe Consistency in DDD project in single aplication?

If two BC want to save some data into different collection. It may be some consistency problem. Do somebody know how to resolve this problem? The usual solution is to stop expecting that the two ...
VoiceOfUnreason's user avatar
3 votes
Accepted

Bidirectional sync between two databases with differing schemas

If this is feasible depends heavily on what 'similar' data means, and if the systems are sufficiently different, this can become arbitrary complex, and you may have to resdesign the existing systems ...
Doc Brown's user avatar
  • 221k
3 votes

eCommerce category path - names vs IDs

Both names and IDs create a series of difficulties. You already listed a few ones in your question, such as the removal of a parent category. Another major issue is that categories are a completely ...
Arseni Mourzenko's user avatar
3 votes
Accepted

What's the difference between MongoDB Query API and MondoDB Query Language?

MQL is a set of high-level syntax and grammar rules designed around interacting with the data itself, not a complete API description. The API is MongoDB's externally-facing boundary which expects MQL ...
Ben Cottrell's user avatar
  • 12.1k
2 votes

Storing a re-orderable list in a database

While the OP briefly touched on the notion of using a Linked-List to store sort-order, it has a lot of advantages for cases where items will be reordered frequently. I have seen people using a self-...
Dai's user avatar
  • 678
2 votes

OLTP vs OLAP - MongoDB

Is MongoDB not recommended for OLTP processing? No, I would not say it's not recommended; it has some pros (simpler scaling / geographic distribution (if you do need it - most orgs don't), no need to ...
Nickolay's user avatar
  • 123

Only top scored, non community-wiki answers of a minimum length are eligible