From 7984c507086d9429d89810e0035636354141e34b Mon Sep 17 00:00:00 2001 From: jc3wish <> Date: Sun, 16 Mar 2025 13:05:49 +0800 Subject: [PATCH] mong oplog tansaction apply ops suppoted --- gtm.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gtm.go b/gtm.go index 9f83b5b..0a0bf77 100644 --- a/gtm.go +++ b/gtm.go @@ -714,6 +714,17 @@ func (op *Op) IsDropDatabase() (string, bool) { return "", false } +func (op *Op) IsTransactionApplyOps() bool { + if op.IsCommand() && op.Namespace == "admin.$cmd" { + if op.Data != nil { + if _, ok := op.Data["applyOps"]; ok { + return true + } + } + } + return false +} + func (op *Op) IsCommand() bool { return op.Operation == "c" } @@ -930,8 +941,8 @@ func (op *Op) ParseLogEntry(entry *OpLog, o *Options) (include bool, err error) op.processData(rawField, o) } include = true - } else if op.IsCommand() { - include = op.IsDrop() + } else if op.IsDrop() || op.IsTransactionApplyOps() { + include = true } } }