开发者

what is the best way to use datetime in mongoDB

开发者 https://www.devze.com 2023-02-14 11:21 出处:网络
I am parsing nginx log and I want to store date and time from my logs to mongodb..I am storing date as stri开发者_开发技巧ng(in this format yyyy-mm-dd) in my database and my programming language is pe

I am parsing nginx log and I want to store date and time from my logs to mongodb..I am storing date as stri开发者_开发技巧ng(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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消