Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-3441

mongorestore with --oplogReplay doesn't apply dropIndex command

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • TAR 2023-11-27, TAR 2023-12-11
    • 283

      Problem Statement/Rationale

      I am syncronizing differents mongodb instances with mongodump + mongorestore using the mongodump --db local --collection oplog.rs to export oplog records from source and mongorestore -oplogReplay to apply changes on target database.

      When I create a index on source instance, mongodump export this operation from oplog and mongorestore apply this on target instance, but when I drop the index on source, mongodump export this operation but mongorestore don't apply the drop on destination.

      Steps to Reproduce

      1. Drop the index on source instance.

      2. Export oplog from source:

       

      mongodump --host localhost:27018 --db local --collection oplog.rs  --out ./data/ --gzip

       

      3. Import changes on target:

       

      mongorestore --host localhost:27019 --gzip --oplogReplay --stopOnError ./data/local/oplog.rs.bson.gz
      

      4. Check the indexes on source and destination

      Expected Results

      I expect that the index be removed on target database.

      Actual Results

      The file data/local/oplog.rs.bson contains both operation (createIndex and dropIndexes), but mongorestore can only create the index, not drop them.

       

            Assignee:
            huan.li@mongodb.com Huan Li (Inactive)
            Reporter:
            rafaelsrocha@gmail.com Rafael Rocha
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: