Reputation: 189
I have a Mongo database storing information about some weather stations. For example:
{
"_id" : ObjectId("5ae052a739027d186162ed50"),
"src_id" : NumberInt(55844),
"Name" : "ABERDEEN: NIGG HEAD WORKS",
"Area" : "ABERDEENSHIRE",
"Area type" : "COUNTY",
"Station start date" : ISODate("1997-03-01T00:00:00.000+0000"),
"Station end date" : null,
"Postcode" : "AB12",
"loc" : {
"type" : "Point",
"coordinates" : [
-2.06163,
57.1318
]
}
}
In order to find the records with empty "Station end date"
I do the following query in Mongodb and it works:
db.MIDAS_stations.find({
"Station end date" : null
})
However, using pymongo
I tried without success. In theory, this should work, but it doesn't:
returned_location = db.MIDAS_stations.find(
{
"Station end date" : None
}
)
print(list(returned_location))
It always returns an empty result. Any ideas of how can this be sorted?
Upvotes: 0
Views: 67
Reputation: 189
The code works just fine. The problem was that I was connected to a different database, containing the data before it was prepared. Shame on me.
Upvotes: 1