docs: add common MongoDB query reference (closes #76)#95
Open
Mrsandeep27 wants to merge 1 commit intoPhonePe:mainfrom
Open
docs: add common MongoDB query reference (closes #76)#95Mrsandeep27 wants to merge 1 commit intoPhonePe:mainfrom
Mrsandeep27 wants to merge 1 commit intoPhonePe:mainfrom
Conversation
Adds `docs/common-db-queries.md` — a playbook of frequently-needed MongoDB queries against Mantis' three main collections (`assets_collection`, `extended_assets_collection`, `findings_collection`). Covers the use-cases called out in the issue (TLDs under an org, subdomains for a TLD, High/ Critical findings for an org) plus related queries users reach for in practice: asset counts, CDN / WAF / ASN / tech breakdown, finding type grouping, new-in-last-24h, cross-collection joins, a Python/Motor snippet, and indexing hints. Linked from the README "Join" section so it's discoverable. Closes PhonePe#76 Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #76. Adds
docs/common-db-queries.md— a quick-reference playbook of the MongoDB queries Mantis users most frequently need, grouped by collection.Directly covers the three examples called out in the issue:
List every TLD under an organisationAll subdomains for a given TLDHigh and Critical severity issues for an organisation…and adds ~20 more queries that tend to come up in practice.
What's in the doc
Assets
Findings
Extended assets
Cross-collection
Extras
mantis/db/database.pyso creds stay out of scripts)Verification
mantis/db/db_models.py—Assets,Findings,Extended— so every field used in a query actually exists on the model.asset_typevalues ("TLD","subdomain","ip","certificate","third_party_integration") taken frommantis/constants.pyso they match what the pipeline writes.Findingsmodel (Literal['vulnerability', 'misconfiguration', 'secret', 'phishing', 'informational']).Test plan
mongosh mantis --eval "load('docs/example-queries.js')"isn't required since the doc is standalone reference — but each query is copy-paste runnable inmongosh, Compass, Studio 3T, or Motor.No code changed. Docs-only.
🤖 Generated with Claude Code