格式大同小异,2.4版本又改回去了。ts格式2.2版本中是Timestamp(1364186197000, 58)形式,MongoDB2.0版本及MongoDB2.4版本是{ "t" : 1361948104000, "i" : 325 }形式,另外若用MongoDB2.4版本的客户端(mongo)查看2.2版本的,看到的是MongoDB2.4版本的格式,这个只与mongo版本有关。 oplog相关字段含义 ts: the time this operation occurred. h: a unique ID for this operation. Each operation will have a different value in this field. op: the write operation that should be applied to the slave. n indicates a no-op, this is just an informational message. ns: the database and collection affected by this operation. Since this is a no-op, this field is left blank. o: the actual document representing the op. Since this is a no-op, this field is pretty useless. The o field now contains the document to insert or the criteria to update and remove. Notice that, for the update, there are two o fields (o and o2). o2 give the update criteria and o gives the modifications (equivalent to update()‘s second argument). ts:8字节的时间戳,由4字节unix timestamp + 4字节自增计数表示。 这个值很重要,在选举(如master宕机时)新primary时,会选择ts最大的那个secondary作为新primary。 op:1字节的操作类型,例如i表示insert,d表示delete。 ns:操作所在的namespace。 o:操作所对应的document,即当前操作的内容(比如更新操作时要更新的的字段和值) o2: 在执行更新操作时的条件,仅限于update时才有该属性。 其中op,可以是如下几种情形之一: "i": insert "u": update "d": delete "c": db cmd "db":声明当前数据库 (其中ns 被设置成为=>数据库名称+ '.') "n": no op,即空操作,其会定期执行以确保时效性 。 20130719更新:今天发现修改配置,会产生 "n" 操作