Have a little python/pymongo program that essentially does the following:
for histarticlenumber in location["inarticle"]:
mdbfilter = {"articleid": histarticlenumber}
projection = {"articletitle": 1, "dateEdiISO": 1, "_id": 0}
articledoc = artcoll.find_one(mdbfilter, projection)
if articledoc is not None:
edidate = datetime2yyyymmddstr(articledoc["dateEdiISO"])
arturiref = articles_ns[
edidate + "-" + slugify(articledoc["articletitle"])
]
This morning found it had broken during the night with a CursorNotFound error.
I am confused since I am using find_one, which returns a Document (or None), not a cursor.
What’s happening? Thanks
Here’s the whole trace:
Traceback (most recent call last):
File "/home/bob/code/mema/src/utilities/transcoders/mdb2rdf_loc.py", line 117, in <module>
main()
File "/home/bob/code/mema/src/utilities/transcoders/mdb2rdf_loc.py", line 98, in main
loc_graph, locmentions_graph = build_two_rdf_graphs(
File "/home/bob/code/mema/src/utilities/transcoders/mdb2rdf_loc.py", line 40, in build_two_rdf_graphs
for location in loccoll.find(mdbfilter):
File "/home/bob/.cache/pypoetry/virtualenvs/mema-NHKGf2LO-py3.10/lib/python3.10/site-packages/pymongo/cursor.py", line 1248, in next
if len(self.__data) or self._refresh():
File "/home/bob/.cache/pypoetry/virtualenvs/mema-NHKGf2LO-py3.10/lib/python3.10/site-packages/pymongo/cursor.py", line 1188, in _refresh
self.__send_message(g)
File "/home/bob/.cache/pypoetry/virtualenvs/mema-NHKGf2LO-py3.10/lib/python3.10/site-packages/pymongo/cursor.py", line 1052, in __send_message
response = client._run_operation(
File "/home/bob/.cache/pypoetry/virtualenvs/mema-NHKGf2LO-py3.10/lib/python3.10/site-packages/pymongo/_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "/home/bob/.cache/pypoetry/virtualenvs/mema-NHKGf2LO-py3.10/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1330, in _run_operation
return self._retryable_read(
File "/home/bob/.cache/pypoetry/virtualenvs/mema-NHKGf2LO-py3.10/lib/python3.10/site-packages/pymongo/_csot.py", line 105, in csot_wrapper
return func(self, *args, **kwargs)
File "/home/bob/.cache/pypoetry/virtualenvs/mema-NHKGf2LO-py3.10/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1448, in _retryable_read
return func(session, server, sock_info, read_pref)
File "/home/bob/.cache/pypoetry/virtualenvs/mema-NHKGf2LO-py3.10/lib/python3.10/site-packages/pymongo/mongo_client.py", line 1326, in _cmd
return server.run_operation(
File "/home/bob/.cache/pypoetry/virtualenvs/mema-NHKGf2LO-py3.10/lib/python3.10/site-packages/pymongo/server.py", line 134, in run_operation
_check_command_response(first, sock_info.max_wire_version)
File "/home/bob/.cache/pypoetry/virtualenvs/mema-NHKGf2LO-py3.10/lib/python3.10/site-packages/pymongo/helpers.py", line 179, in _check_command_response
raise CursorNotFound(errmsg, code, response, max_wire_version)
pymongo.errors.CursorNotFound: cursor id 7243068530859290909 not found, full error: {'ok': 0.0, 'errmsg': 'cursor id 7243068530859290909 not found', 'code': 43, 'codeName': 'CursorNotFound'}