Skip to content

Latest commit

 

History

History
152 lines (111 loc) · 6.83 KB

README.md

File metadata and controls

152 lines (111 loc) · 6.83 KB


Mongo trace viewer

Mongo trace viewer - Latest release

Warning: This is a proof-of-concept project, additional features will be added only when needed.

Motivation

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?

Index

What is MongoDb Replica Set Oplog

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.

Get Started

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.

Binaries

Features

  • Search for data changes in database collections

Search

  • Filter by Record id

Id filtering

  • Filter by Min/Max date of changes

Date filtering

  • Favourite filters

Favourite filters

Docker support

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

Limitations

  • 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.

Tech Stack

  • 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.

Binaries

https://github.com/contributeless/mongo-oplog-viewer/releases

Useful links

License

Mongo oplog viewer is licensed under MIT.