The business structure to be designed is as follows:
var mySchema = new Schema({
projectname: String,
author: String,
body: String,
task: {
taskname: String,
user: String,
picture: {
url1,
url2,
url3,
...
},
}
});
Describing the business structure in words means that each project contains n tasks and n pictures under each task.
Daily operations are
1. new project = > new task = > upload n maps.
2. update project task, etc.
I would like to ask whether my database design is reasonable. Is there a better way? Express development is used.
Absolutely! Some business scenarios are especially suitable for this nested subset design. To use data
project
Data, need to usetask
. This kind of query requires only one table and is very efficient. Andmongo
Support for subsets is also better.