英文:
What is the best storage for data without relations
问题
我正在开发一个基于Spring Boot的简单Web应用程序,只需要一个表格(内部有四列)的数据,没有任何关联。因此,数据模型非常简单,但仍然需要在某个地方存储数据,并且在应用程序重置后不能消失。
这个表格(或一些数据集合)包括对象,其中每个对象有三个单词的字符串作为分开的属性和一个布尔属性。两个字符串是不可变的(名字和姓氏)。在应用程序的生命周期内,对象中可能只有布尔字段会发生变化。这个变化将被计划并每周执行一次。
我不需要事务,应用程序也不是多线程的。这是一个纯Java应用程序。查询将仅从计划任务中执行。数据集合的大小将保持在相同的水平。它也将是一个非常内部的应用程序,因此我们不必担心在大型基础架构中出现的一些问题。
在这种情况下,我应该使用哪种类型的存储?像Mongo这样的NoSQL数据库?还是将这些数据存储在服务器端的某个文件中并进行读写?
英文:
I am developing a simple web application based on Spring Boot, which needs only one table (four columns inside) of data without any relationships. So the data model is very light, but still, it has to be store in someplace and cannot disappear after the application reset.
Table (or some collection of data) includes objects, where every object has three one-word strings as separated properties and one boolean property. Two strings are immutable (name and surname). During the application life, probably only the boolean field will be changed in objects. This change will be scheduled and executed once a week.
I do not need transactions, and also application is not multi-threaded. It is Java-only application. Queries will be executed only from scheduled task. Size of data collection will be keeping at the same level. It also is going to be very internal application, so we do not have to keep notice about some problems which appear in big infrastructures.
Which type of storage should I use in this case? Some NoSQL databases like Mongo? Or maybe keep this data inside some file stored on the server-side and read/write to it?
答案1
得分: 2
你计划搜索吗?
如果不计划,那么使用平面文件是解决方案。
如果是的话,你需要对其进行索引。所以最好使用数据库。
任何数据库都可以!
Mongo 的优势在于可以随时更改架构,所以在你的情况下可能是一个不错的选择。
只需记得对集合进行索引!
英文:
Do you plan to search thru it?
If NO then a flat file is the solution.
if YES you will need to index it. So better use DB for that.
Any DB would do!
Advantage with mongo is that one can change the schema on the fly, so perhaps a decent choice in your case.
Just remember to index the collection!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论