Skip to content

EojinK1m/qmid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

qmid

Quick MongoDB Id - A simple CLI tool to generate MongoDB ObjectIds from datetime and vice versa.

Installation

cargo install --git https://github.com/EojinK1m/qmid

Usage

Usage: qmid [OPTIONS] [INPUT]

Arguments:
  [INPUT]  Datetime or ObjectId to convert

Options:
  -r, --random   Generate random suffix instead of zeros
  -h, --help     Print help
  -V, --version  Print version

Generate ObjectId from datetime

# No args: current time + random suffix
qmid

# Date only
qmid 20251201
qmid 2025-12-01

# Date + time (various formats)
qmid 2025120114            # hour only
qmid 202512011430          # hour + minute
qmid 20251201143000        # full
qmid 20251201T14           # with T separator
qmid 20251201T1430
qmid 20251201T143000
qmid 2025-12-01T14:30:00   # ISO format
qmid 2025-12-01T14:30:00Z  # with Z suffix

# With random suffix (-r flag can be anywhere)
qmid -r 20251201
qmid 20251201 -r
qmid 20251201 --random

Decode ObjectId to timestamp

qmid 692cda800000000000000000
# Output: 2025-12-01T00:00:00Z

Examples

$ qmid
695cb1234a1b2c3d4e5f6789

$ qmid 20251201
692cda800000000000000000

$ qmid 2025-12-01T14:30:00
692da6680000000000000000

$ qmid -r 20251201
692cda80a1b2c3d4e5f67890

$ qmid 692cda800000000000000000
2025-12-01T00:00:00Z

License

MIT

About

A simple CLI tool for generating ObjectIds and extracting timestamps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages