File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
source/includes/databases-collections Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
require 'vendor/autoload.php ' ;
3
3
4
- $ uri = getenv ('MONGODB_URI ' ) ?: throw new RuntimeException ( ' Set the MONGODB_URI variable to your Atlas URI that connects to the sample dataset ' ) ;
4
+ $ uri = getenv ('MONGODB_URI ' ) ?: ' mongodb://localhost:27017 ' ;
5
5
$ client = new MongoDB \Client ($ uri );
6
6
7
7
// Creates a time series collection to store precipitation data
12
12
'timeseries ' => [
13
13
'timeField ' => 'timestamp ' ,
14
14
'metaField ' => 'location ' ,
15
- 'granularity ' => 'minutes '
15
+ 'granularity ' => 'minutes ' ,
16
16
]
17
17
];
18
18
36
36
[
37
37
'precipitation_mm ' => 0.5 ,
38
38
'location ' => 'New York City ' ,
39
- 'timestamp ' => new MongoDB \BSON \UTCDateTime (1694829060000 )
39
+ 'timestamp ' => new MongoDB \BSON \UTCDateTime (1694829060000 ),
40
40
],
41
41
[
42
42
'precipitation_mm ' => 2.8 ,
43
43
'location ' => 'New York City ' ,
44
- 'timestamp ' => new MongoDB \BSON \UTCDateTime (1695594780000 )
45
- ]
44
+ 'timestamp ' => new MongoDB \BSON \UTCDateTime (1695594780000 ),
45
+ ],
46
46
]
47
47
);
48
48
// end-insert-ts
You can’t perform that action at this time.
0 commit comments