Mongo trace viewer - Latest release
I always found myself spending too much time debugging data loss cases using MongoDB. Whenever I need to view what happened to my data, I had to use robomongo/robo3t or something else to view mongo/local/oplog.rs collection and build complex queries to get the actions that happened in my database.
So as a developer, why not solve it the way that fits better with what I am good at?
- What is MongoDb Replica Set Oplog
- Get Started
- Features
- Docker support
- Limitations
- Tech Stack
- Binaries
- Useful links
- License
The oplog (operations log) is a special capped collection that keeps a rolling record of all operations that modify the data stored in your databases.
Official documentation for Replica Set Oplog.
Here is a light demo. The app is deployed on heroku and uses a free Mongo Atlas instance. It can be "a bit" slow due to performance limitations of the free services.
The best way to understand it is to try it. Please download the executable for your operating system and try the application with local version of MongoDB.
- Search for data changes in database collections
- Filter by Record id
- Filter by Min/Max date of changes
- Favourite filters
The app is also available on DockerHub
Use the following command to run the image locally:
docker run -p 8080:80 contributeless/mongo-oplog-viewer:v0.0.4
- Oplog.rs collection is only available for MongoDB instances running in ReplicaSet mode. So it will not be available for standalone MongoDB instances. If you want to use the oplog viewer in this case, see How to setup an oplog on a single MongoDB instance
- The records in oplog.rs collection can be removed by the MongoDB instance. According to documentation:
The mongod only removes an oplog entry if:
1.The oplog has reached the maximum configured size, and
2.The oplog entry is older than the configured number of hours based on the host system clock.
By default MongoDB does not set a minimum oplog retention period and automatically truncates the oplog starting with the oldest entries to maintain the configured maximum oplog size.
- React.js - JavaScript library for building user interfaces.
- Unstated - State management library.
- Moment.js - A JavaScript date library for parsing, validating, manipulating, and formatting dates.
- EventEmitter3 - High performance EventEmitter.
- React-Toastify - React-Toastify allows you to add notifications to your app with ease.
- Reactjs-popup - Simple react popup component that helps you create simple and complex Modals, tooltips, and Menus for your next React App.
- react-json-view - RJV is a React component for displaying and editing javascript arrays and JSON objects.
- react-datetime - A date and time picker in the same React.js component.
- express - Fast, unopinionated, minimalist web framework for node.
- MongoDB NodeJS Driver - The official MongoDB driver for Node.js.
- TypeScript - TypeScript is a language for application-scale JavaScript.
- winston@3 - Simple and universal logging library with support for multiple transports.
- cors - CORS is a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.
- nodejs - Node.js is an open-source, cross-platform, JavaScript runtime environment.
https://github.com/contributeless/mongo-oplog-viewer/releases
- Official MongoDB documentation: Replica Set Oplog
- Medium article: Understanding MongoDB Oplog
- Hevo article: Working with MongoDB Oplog: A Comprehensive Guide
Mongo oplog viewer is licensed under MIT.