Querying COVID-19 Data With MongoDB Atlas

The Dev Rel team at MongoDB has recently taken on the job of keeping a copy of the Johns Hopkins COVID Data set consistent in MongoDB Atlas. You can find the full details on developer.mongodb.com.

As a quick start the connection URL is:

mongodb+srv://readonly:readonly@covid-19.hip2i.mongodb.net/covid19

The username is literally readonly as is the password.

The data-set is updated daily by Johns Hopkins and our data-set is updated when there's is. So no downloading, no formatting, just a database you can query with either MQL (MongoDB Query Language) or SQL.

You can connect with our shell:

C:\Users\joe>mongo --host="mongodb+srv://readonly:readonly@covid-19.hip2i.mongodb.net/covid19" --username readonly --password readonly
MongoDB shell version v4.2.0
connecting to: mongodb://covid-19-shard-00-00.hip2i.mongodb.net:27017,covid-19-shard-00-01.hip2i.mongodb.net:27017,covid-19-shard-00-02.hip2i.mongodb.net:27017/covid19?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=covid-19-shard-0&ssl=true
2020-04-21T18:41:47.011+0100 I  NETWORK  [js] Starting new replica set monitor for covid-19-shard-0/covid-19-shard-00-00.hip2i.mongodb.net:27017,covid-19-shard-00-01.hip2i.mongodb.net:27017,covid-19-shard-00-02.hip2i.mongodb.net:27017
2020-04-21T18:41:47.012+0100 I  CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to covid-19-shard-00-02.hip2i.mongodb.net:27017
2020-04-21T18:41:47.013+0100 I  CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to covid-19-shard-00-01.hip2i.mongodb.net:27017
2020-04-21T18:41:47.013+0100 I  CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to covid-19-shard-00-00.hip2i.mongodb.net:27017
2020-04-21T18:41:47.256+0100 I  NETWORK  [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for covid-19-shard-0 is covid-19-shard-0/covid-19-shard-00-00.hip2i.mongodb.net:27017,covid-19-shard-00-01.hip2i.mongodb.net:27017,covid-19-shard-00-02.hip2i.mongodb.net:27017
Implicit session: session { "id" : UUID("136625d1-7334-4f27-88de-79ae8427a45b") }
MongoDB server version: 4.2.5
MongoDB Enterprise covid-19-shard-0:PRIMARY> db.statistics.find({"country" : "Ireland","date": new Date("2020-04-19")}).pretty()
{
        "_id" : ObjectId("5e9e42243232859552f0c91b"),
        "uid" : 372,
        "country_iso2" : "IE",
        "country_iso3" : "IRL",
        "country_code" : 372,
        "country" : "Ireland",
        "combined_name" : "Ireland",
        "population" : 4937796,
        "loc" : {
                "type" : "Point",
                "coordinates" : [
                        -7.6921,
                        53.1424
                ]
        },
        "date" : ISODate("2020-04-19T00:00:00Z"),
        "confirmed" : 15251,
        "deaths" : 610,
        "recovered" : 77
}
MongoDB Enterprise covid-19-shard-0:PRIMARY>

If you prefer SQL, no problem. You can connect to our built-in BI-Connector.

CONNECTION METHOD                      = TCP/IP
HOSTNAME                               = covid-19-biconnector.hip2i.mongodb.net
PORT                                   = 27015
USE SSL                                = Require
Enable Cleartext Authentication Plugin = True

You can see these articulated in the main MySQL Workbench screen:

login screen

And the SSL tab:

ssl tab screen

And finally the Advanced tab:

advanced tab screen

Once these are setup you can test the connection and you should see:

test connection screen

Once you have a successful connection you can connect and do queries:

make a query screen

For examples of all the other ways you can connect scoot on over to our COVID-19 page on developer.mongodb.com.

Try MongoDB in the Cloud

Create a free account and launch a cluster in minutes!