Get ids of replaced documents in bulkWriteResult


I’m performing the following operation:


I have 2 questions:

(1) I need to know the _ids of the document that matches the query and performs the replace operation. From the doc, I see I can retrieve only document that are inserted into the field upsertedIds.

(2) The field upsertedIds is a dictionary with the key equals to the index number and the value equal to the _id of course. I wonder what’s the value of the index number used as a key to the dictionary.