So guys,
I will try to make this as simple as possible:
Object:
...
status: str [open, close]
Flow:
1 - create object on mongo [status=open]
2 - update object on mongo [status=close]
3 - fetch object from mongo using find [filter status = open -> returns 0 objects]
4 - fetch object from mongo using AtlasSearch [compound must query for status = open -> 50% it will return 1 object with status=close, lol right?
If I add time.sleep between steps 3 and 4, everything works fine. I believe this happens because I make query before objects are indexed properly. Thus, I am looking for a better way to resolve this matter. Is there a way to wait until all objects are indexed in pymongo? I saw how they index stuff, but could not find how to wait until all docs are indexed.
Thanks!
time.sleep() resolves but not a good way to go.