Veyra Query Lens for MongoDB icon
NEW · VEYRA ORIGINAL · FOR VS CODE

Veyra Query Lens for MongoDB

See how every MongoDB query performs, right above your code.

Slow queries usually show up in production. Query Lens shows them while you write them: the documents each query reads, the index that fixes it, the indexes nothing uses, and where your Mongoose schemas don't match your data.

flightcoders.veyra-mongodb · v1.0.0 · Free · MIT · Windows, macOS, Linux

Lenses above four MongoDB queries: a full collection scan with a Create index button, two that use an index, and an in-memory sort
FEATURES

Find slow MongoDB queries before your users do.

A lens above every query

Documents read vs returned, time, and the index used, from explain() on your development database. Scans and in-memory sorts are flagged.

The index that fixes it

Suggested with MongoDB’s Equality, Sort, Range rule. Create it in one click and watch the lens turn green.

Works on real app code

Values your code computes at run time are filled with real values from the collection, so you see the plan your app really gets.

Index Doctor

The indexes your code is missing, and the ones nothing uses or that duplicate another, with sizes and use counts.

Schema drift

Mongoose schemas compared with real documents: wrong types, missing required fields, and fields Mongoose silently drops.

Problems and quick fixes

Slow queries appear in the Problems panel. Ctrl+. creates the index or copies it as code.

Node.js, Mongoose, Python

The official driver, Mongoose models from any file, PyMongo and Motor, with sorts, limits and aggregation $match stages.

Safe by design

Explain only, with time limits. Nothing changes unless you confirm, and a read-only mode makes changes impossible.

No setup

A local MONGODB_URI in .env connects by itself. Connection strings live in VS Code’s secret storage.

Query details: the verdict, the numbers, the plan, the suggested index and the code to add it in Mongoose, Node.js, Python or mongosh
HOW IT WORKS

Your code, your data, MongoDB's own answer.

  • Reads your code for find, aggregate, count and update calls in JavaScript, TypeScript and Python, and works out each collection.
  • Fills in run-time values with real ones from the collection, so the plan is the one your app gets.
  • Asks MongoDB with explain("executionStats"), with a time limit, and reads the plan from both query engines.
  • Explains it in plain words, with the index that fixes it, and never suggests one you already have.
orders.service.ts⚠ Full collection scan · 48,210 read → 20 returned
Order.find({ customerId })
.sort({ createdAt: -1 })
fix: { customerId: 1, createdAt: -1 }
Index Doctor: a missing index, an unused index, a duplicate index, every collection's indexes, and Mongoose schemas compared with the data
A Mongoose schema with underlined fields, and problems where documents don't match it
INSTALL

Ready in a minute.

  1. Download the .vsix (395 KB).
  2. In VS Code, press Ctrl+Shift+P and run Extensions: Install from VSIX…, then choose the file.
  3. Open a project that uses MongoDB. With MONGODB_URI in .env it connects by itself; otherwise run MongoDB Lens: Connect to MongoDB….

Everything is explained in the User Guide, which also ships inside the extension. Coming to the Visual Studio Marketplace soon.

Command PaletteMongoDB Lens: Connect to MongoDB…
MongoDB Lens: Check All Queries
MongoDB Lens: Open Index Doctor
MongoDB Lens: Check Schema Against Data
MongoDB Lens: Open User Guide
FAQ

Questions

Is it free?

Yes. Veyra Query Lens is free and MIT licensed, with no account and no telemetry.

Does it run my queries on the database?

It runs explain("executionStats") for the find() each query makes, which reads documents like the query does, with a time limit. Updates and deletes are never run. Indexes are created or dropped only when you click and confirm.

Which database should I connect?

A development database, ideally with realistic data: plans depend on the data. On databases that aren’t on your computer, queries are checked only when you click, and you can turn on read-only mode.

How is it different from MongoDB’s own extension?

MongoDB for VS Code lets you browse data and run queries in playgrounds. Query Lens works on the queries in your application code: it checks each one where it’s written, suggests the index that fixes it, finds unused indexes, and compares Mongoose schemas with your data. They work well side by side.

What if a query is matched to the wrong collection?

Add a comment like // veyra-collection: orders on the line above it.

More for VS Code: Veyra Env, Veyra Container Studio for Docker, Veyra MCP Studio and Veyra API Client.

MongoDB is a trademark of MongoDB, Inc. Veyra Query Lens is an independent extension and is not made or endorsed by MongoDB, Inc.

Made by the Veyra team.

Veyra Studio is a fast, free code editor with Live Server, Python debugging and Veyra AI built in.

Download VeyraView on GitHub