4

I am parsing nginx log and I want to store date and time from my logs to mongodb..I am storing date as string(in this format yyyy-mm-dd) in my database and my programming language is perl.What is the best effective way to store date..should I use perl datetime module to format date like this ""date" : "Sun Feb 13 2011 05:30:00 GMT+0530 (IST)""

I really want to understand what is the best way to store date in mongodb.Please guide me

Abh
  • 105
  • 1
  • 7
  • possible duplicate of [Best way to store date/time in mongodb](http://stackoverflow.com/questions/3778428/best-way-to-store-date-time-in-mongodb) – Dan Dascalescu Feb 10 '14 at 11:00

1 Answers1

3

I suppose that for logs better to story date as date but not as string, because with string you will not able query for logs from one date to another(range). I suppose that you will use range queries more than others.

Andrew Orsich
  • 52,935
  • 16
  • 139
  • 134