MongoDB Time Data Model Note

前端之家收集整理的这篇文章主要介绍了MongoDB Time Data Model Note前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<table class="text"><tr class="li1">
<td class="ln"><pre class="de1">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

Local Time Convertion   Since MongoDB stores times in UTC by default,there is no worry when you store time,and MongoDB would convert your time to UTC time automatically.But the applications has the following situations where you should look after the conversion.           1) When provide time filter for query,local time is used here.            Take a example in CST,you should use 'new Date("2017-03-02T08:00:00+08:00")' in ISODate        format,and MongoDB would convert it to UTC time.                 2) When return result from query,the result should be in local time foramt.            Date object offers happy way to display UTC time in local time string format:        New Date().toString                    

猜你在找的MongoDB相关文章