Mongodb Design for Vehicle Track Table

  mongodb, question

Encountered a technical problem
For monitoring the driving path of nearly 10,000 vehicles (or even more), I have two choices when designing the table (set) of the database (mongdo)
1. According to the talent table, all the vehicle tracks of each day are put in one table.
Second, according to the car division table, each license plate corresponds to a table.

What do you think is reasonable?

Your requirement is a very common requirement, usually called Time Series data modeling.

1. It is not recommended to divide into different Collections; by day/by car;

2. if you have a very large number of documents, consider Sharding.

Because you have disclosed less information, if you get the location of the car every minute, you might as well try the following:

{ 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 a document contain more information and improve the query efficiency.

For reference.

Love MongoDB! Have Fun!


MongoDB Online Lecture Series 19- MongoDB 10 Steps to Build a Single View

On April 19, please stamp: ><