[SERVER-8605] Oplog contains missing information ? Created: 18/Feb/13 Updated: 08/Mar/13 Resolved: 18/Feb/13 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Question | Priority: | Major - P3 |
| Reporter: | Kurt Agius | Assignee: | Unassigned |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Participants: | |||||||||
| Description |
|
Question about the opLog for mongodb. I am using oplog to trigger events based on the database updates. If you try: db.notes.insert( {status:'new',subject:'subject 1'}) db.notes.update({_id: ObjectId("512231109946135b79af6bec")}, {status:'pending',subject:'subject 2'}); //We expect that both fields are shown in oplog (CORRECT) , , , , db.notes.update({_id: ObjectId("512231109946135b79af6bec")},{$set:{status:'close',subject:'subject 3'}}); //We expect that both fields are shown in oplog (WRONG only one shown) , , , }, Any idea why this happens ? |
| Comments |
| Comment by Scott Hernandez (Inactive) [ 18/Feb/13 ] |
|
While the client will be able to read each field individually (no more duplicate field names at the same level) in the new version, all versions were/are valid as far as replication is concerned (the C++ client deals fine with duplicate fields of the same name at the same level). The meaning and values of any fields is what I'm referring to, not the field names and order – and this meaning is the part that is internal and may change in future versions. |
| Comment by Kurt Agius [ 18/Feb/13 ] |
|
Thanks for your quick reply. I hope that version 2.4 will be available soon. I can understand that the format is internal, but i think it will become stable, so replication between different versions of master and slave will be possible. Of course, i understand that if the format changes, i have to make sure that my logic still works. One last (maybe stupid) question... I'm not really sure what you mean by "your client can't read the changed fields". Shouldn't that be "a standard format" that every client can read (assuming it's latest version) ? |
| Comment by Scott Hernandez (Inactive) [ 18/Feb/13 ] |
|
This is a client issue because of the format on the oplog entries (docs with repeated fields): Please upgrade to 2.4.0+ when it is available, or use a fixed client (not sure there is one for node.js), or re-read the whole document since your client can't read the changed fields. Since the oplog entries are idempotent and not a representation of what change you asked for (the result may be more than just the change the client issued) you may want to rethink your use of the oplog information. It provides a general tool for detecting change (it will let you detect the document and where it was updated/inserted/removed) but since the format is internal (and may change in any version) you should be careful how closely you tie your application logic to it. |