What do the oplog fields mean?
I've seen this question before, but the answers were very vague. I am doing some research on oplog and trying to understand how it works. In particular, I want to have a good understanding of the fields in the oplog document and what kind of data they store.
These are the fields I found in the tests and what I think they mean, as well as what I still don't know:
- ts: timestamp of operation recording / oplog recording
- h: unique id of the oplog entry (but why is this sometimes positive and sometimes negative?)
- op: the type of operation to perform (usually i / u / d for insert, update, or delete)
- ns: damaged database and collection.
- o: the new state of the document after making a change
- o2: The update seems to contain the _id field of the document. Why is this necessary when this same field is present as part of the o field, which also contains the rest of the document?
- b: It seems to be a bool that appears for delete operations. What is the meaning of this area?
I would like to confirm if the exact points I made above are accurate as well as explanations for the fuzzy bits. I'm also curious to see if there are other fields that may appear in the oplog document.
+3
source to share
1 answer
- h - hash (signed long)
- ts is an internal timestamp format (type "\ x11" shown at bsonspec.org; search for the API documents for your driver at api.mongodb.org for more information).
- You are right about op, ns, o and o2
- there's also a "v" field (I'm going to assume this is the version that will allow them to update the schema for the oplog).
- b True for all delete operations I could find, so I cannot provide any information.
The best documentation source I have found is this . This was a presentation from a company called Stripe at the MongoDB 2014 World Conference, and it includes sample Ruby code.
+5
source to share