What are the differences between the find and find_one methods?

I am running some QA on a project I took over and I am trying to find out why when I check if there is any missing data based on a file of notice_id(s)

missing = 0
for notice_id in notice_ids:
    rec = collection.find_one( {"noticeId":notice_id } )
    if not rec:
        missing += 1
print(f"There are {missing} missing of {len(notice_ids)} records")

I get There are 366 missing of 486 records

However, when I update my script using the .find method instead of the .find_one the answer becomes There are 0 missing of 486 records

Nevermind, the find method returns a cursor

Well when i loop through the cursor like,

missing = 0
for notice_id in notice_ids:
    for doc in collection.find({"noticeId":notice_id }):
        if not doc:
            missing+=1
print(f"There are {missing} missing of {len(notice_ids)} records")

I return 0; why is the find_one method not finding all the records?

Both methods work. But your code is wrong. With the find code

missing will always be 0 because the find() returns no documents the if not doc: in your for loop is never executed but if not rec: is always executed.