I have never used mongo db, I made a mongoDB data base called MilitaryMarathonDB and a collection called CIS4340
here is a sample record:
{“_id”:{“$oid”:”662aef4884f1ffcadbc2edc0″},”place;gender;first;last;bib #;age;place;gender place;clock time;net time;branch;distance”:”194;M;JACOB;PELLETIER;3053;29;12111;4981;7:43:21;7:20:05;Army;marathon”,”Unnamed: 1″:{“$numberDouble”:”NaN”}}
As you can see M indicates the gender of the runner.
I am trying to run a query to get the 10 fastest females, i tried the below code in python and it did not work. and then i tried running directly in mongoDB {gender : “F”} and it returned “QUERY RESULTS: 0”
Even though there are many Females in the data set. I tried {“gender”: “F”} and every combination of quotation marks I could think of and nothing works.
import pymongo
#MongoDB Atlas connection string
uri = ‘mongodb+srv://SophiaK05:[email protected]/’
#Connect to MongoDB Atlas
client = pymongo.MongoClient(uri)
#Access the database
db = client.MilitaryMarathonDB
#Access the collection (collection name is CIS4340)
collection = db.CIS4340
#Define the query to get female runners
query = {“gender”: “F”} =
#Execute the query and sort by net time in ascending order
results = collection.find(query).sort(“net time”, 1).limit(10)
I ran the above code and I expected it to return the query but it returned nothing.