mongodb design for high traffic gps tracker software

503 views
Skip to first unread message

Mohsen Jahanshahi

unread,
Aug 3, 2017, 6:23:13 PM8/3/17
to mongodb-user
hi

I am new to mongodb.
my app: gps are install on cars and send geography data(long, lat) data  to server every 20 second. 
I want to use mongodb for this.
my plan is to create collection vehicle and store data like this:

{
"gps_id":"67828872",
"fullname":"james",
"data": [ {"lon":11.53144, "lat":48.1567, "speed":20, "time"""}, {"lon":11.53125, "lat":48.15672, "speed":50 , "time"""}
 ...
 // additional track information 
]
}

by doing this I have history of taxi location for every day of year.

my queries are 
1- get line of where how taxi go between two time by getting data of lon and lat for requested time period
2- show live location of taxi on web browser and mobile app, by query last data inserted to db(biggest time field)

Am I doing it correctly??

Kevin Adistambha

unread,
Aug 23, 2017, 9:37:31 PM8/23/17
to mongodb-user

Hi Mohsen

It’s been a while since you posted this. Have you settled on a design yet?

One thing I immediately notice in your proposed design is that you create one document per GPS tracker (e.g. one document per car), and put the GPS observations in an array. This will result in a very big array, and will hit the 16 MB document size limit. Therefore it’s probably best to create one document per car, or limit the amount of entries the array can have, e.g. one document can only contain ~1 hour worth of data. This will depend on your use case, so testing with your expected load is highly recommended.

If you need further information on schema design, please see:

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages