遇到个技术问题对于监控将近10000辆(甚至更多)车驾驶路径轨迹,我在设计数据库 (mongdo)表(集合)时候,有2个选择一. 按天分表,每天的所有车辆轨迹放在一个表中二. 按车分表,每个车牌对应一个表
大家觉得那种合理呢?
光阴似箭催人老,日月如移越少年。
Your demand is a very common one, usually called Time Series data modeling.
1. It is not recommended to divide collections into different collections by day/car;
2. If you have a particularly large number of documents, you can consider Sharding.
Because you reveal less information, if you get the car’s position every minute, you might as well try the following method:
{ plate : String, brand : String, color : String, timestamp_hour : ISODate, track : [{0 : [Longitude, latitude]}, {1 : [xxx, xxx]} ... {59 : [xxx, xxx]}] }
The general idea is to try to make one document contain as much information as possible to improve query efficiency.
For reference.
Love MongoDB! Have Fun!
MongoDB Online Lecture Series 19- MongoDB 10 steps to build a single view
It’s April 19th, please click:>---<
You need to consider the specific business scenario, how to display the data, and the display dimensions.
Your demand is a very common one, usually called Time Series data modeling.
1. It is not recommended to divide collections into different collections by day/car;
2. If you have a particularly large number of documents, you can consider Sharding.
Because you reveal less information, if you get the car’s position every minute, you might as well try the following method:
The general idea is to try to make one document contain as much information as possible to improve query efficiency.
For reference.
Love MongoDB! Have Fun!
MongoDB Online Lecture Series 19- MongoDB 10 steps to build a single view
It’s April 19th, please click:>---<
You need to consider the specific business scenario, how to display the data, and the display dimensions.