Name | Modified | Size | Downloads / Week |
---|---|---|---|
Parent folder | |||
README.md | 2019-07-05 | 1.8 kB | |
files-stats-mongodb.json | 2019-07-05 | 33.7 kB | |
sample.js | 2019-07-05 | 315 Bytes | |
Totals: 3 Items | 35.8 kB | 0 |
Import Files Stats
To import file-stats collection into MongoDB, use the following commands:
# Assumes the following:
# - Database name ....: wspr
# - Collection name ..: filestats
# - No specific username/password set
# - If the collection exists, it will be dropped first
mongoimport --db=wspr --collection=filestats --drop --file=files-stats-mongodb.json
The results should be along the lines of:
2019-06-30T02:47:38.554-0600 connected to: localhost
2019-06-30T02:47:38.587-0600 imported 135 documents
If you've installed the collection previously, you should see
2019-06-30T02:48:50.789-0600 connected to: localhost
2019-06-30T02:48:50.789-0600 dropping: wspr.filestats
2019-06-30T02:48:50.826-0600 imported 135 documents
Check Import Results
To do a quick import check, run the sample js script with"
mongo < sample.js
The sample script prints the first and last documents in the collection with results similar to:
MongoDB shell version v3.6.3
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.3
switched to db wspr
First Document in collection
{
"_id" : ObjectId("5d159a33064f34577959e88a"),
"fileName" : "wsprspots-2008-03.csv",
"lineCount" : 93890,
"csvSize" : 7113501,
"archiveSize" : 693335,
"processDate" : ISODate("2019-06-28T04:40:19Z")
}
Last Document in collection
{
"_id" : ObjectId("5d17c26a23d91dd3c02d186c"),
"fileName" : "wsprspots-2019-05.csv",
"lineCount" : 43477833,
"csvSize" : -621495553,
"archiveSize" : 399032758,
"processDate" : ISODate("2019-06-29T19:56:25Z")
}
Finished sample queries.
bye