KeplerGrid documentation
Guides for connecting to MongoDB, querying it, and moving data with KeplerGrid.
Start here
Open a read-only MongoDB connection and query a collection.
Compare MongoDB Compass and KeplerGrid on the same tasks.
Connect
- MongoDB client for Mac
Install KeplerGrid on Apple Silicon, connect to local MongoDB or Atlas, and find a document with your first query.
- Connect a MongoDB GUI to Docker Compose
Run a loopback-only development MongoDB with Docker Compose and open the same collection in KeplerGrid and MongoDB Compass.
- MongoDB client for Linux and Ubuntu
Install KeplerGrid from its amd64 package on Ubuntu or Debian and connect to a local development database.
- MongoDB client for Windows
Choose the Windows x64 KeplerGrid installer, verify the download, and run your first query on local MongoDB.
- Fix MongoDB ECONNREFUSED on localhost
Check whether MongoDB is listening, whether the port is right, and which loopback address your desktop client is using.
- MongoDB replica set connection string examples
Use a seed list to discover the primary, then diagnose unreachable advertised hosts and single-endpoint Docker setups.
- Connect to MongoDB Atlas
Set up access, connect with an SRV URI, and run a read-only query.
- Fix MongoDB authentication errors
Check the authentication database, credentials, and URI encoding.
- See who can access a collection
Trace collection permissions to direct and inherited MongoDB roles.
- Troubleshoot MongoDB DNS and TLS
Use the connection test to tell a hostname lookup from a certificate problem.
- Inspect MongoDB server health
Read connection and operation metrics and see when they were sampled.
- Inspect MongoDB collection size and counts
Read the size, index, and approximate document metrics in the database browser.
- Run your first MongoDB query in Read only mode
Set up scoped read access and verify one successful query.
- Connect to a replica set over SSH
Reach an internal replica set and check which member is primary.
Query and index
- Rename or remove a MongoDB field across documents
Use a filter and a practice fixture to preview a MongoDB field change, protect existing destination values, and verify the update.
- Update MongoDB array elements with arrayFilters
Use arrayFilters to update one matching order line and verify which elements changed.
- Filter MongoDB documents
Find documents by ObjectId, date range, or text, and sort the results.
- Query arrays with $elemMatch
Require multiple conditions to match the same array element.
- Find null and missing fields
Separate explicit nulls, missing fields, and populated values.
- Return selected fields with projection
Choose nested fields and control whether the result includes _id.
- Edit a nested MongoDB field
Review a Decimal128 change and confirm the stored BSON type.
- Match any or all array values
Choose between $in and $all when filtering a list of tags.
- Count MongoDB documents matching a filter
Compare the complete server count with the loaded page.
- Paginate MongoDB results with a stable sort
Add an _id tie-breaker and continue from the last row.
- Find arrays of a specific length
Use $size and distinguish an empty array from a missing field.
- Combine MongoDB filters with $and and $or
Group conditions so an alternative does not bypass a required filter.
- Audit BSON types in a MongoDB field
Count strings, numbers, nulls, and missing values before changing a validator.
- Test a MongoDB partial index with Explain
Check whether MongoDB can use the index for a particular filter.
- Test MongoDB regex filters with an index
Use Explain to compare an anchored prefix with a broader pattern.
- Exclude values with $nin
See which documents match when the field is missing and how to require it.
- Return part of a MongoDB array
Use projection $slice to return the first, last, or selected elements.
- Reopen a query from Query history
Recover a previous filter, sort, and projection for its collection.
- Query a MongoDB date range with $gte and $lt
Use two BSON Date boundaries to include the start of a reporting period and exclude the beginning of the next one.
- Compare two MongoDB fields with $expr
Find documents where one field exceeds another. Use numeric guards to exclude incomplete or string-valued records.
- Check a MongoDB covered query with Explain
Use a compound index and a projection to answer a query from the index alone. Change one projected field and compare the work MongoDB does.
- Index a MongoDB array field with a multikey index
Index a scalar field alongside an array field. Verify how MongoDB records the array path and check when a compound index can reject writes.
- Expire MongoDB documents with a TTL index
Create a TTL index using a BSON date field and check the expiration rule. Learn which documents remain and why deletion can lag.
- Search MongoDB documents with a text index and $text
Search for words and quoted phrases on a self-managed MongoDB collection. Test the same index against both title and body.
- Test a MongoDB index removal with a hidden index
Hide a secondary index on disposable data, compare Explain, and restore it without waiting to rebuild the index.
- Check MongoDB index usage with $indexStats
Read cumulative access counters and their start time. Confirm which node the counters describe before drawing conclusions about an index.
- Query a MongoDB ObjectId with Extended JSON
Match a BSON ObjectId exactly and distinguish it from a string with the same characters. Use the embedded timestamp only when it fits your data.
- Find distinct MongoDB values and count their documents
List each value once and then add counts for a report. Compare mongosh distinct with an aggregation you can inspect in KeplerGrid.
- Update a MongoDB counter atomically with $inc
Adjust stock in one document and add a filter that prevents the count from going below zero. Inspect the result in KeplerGrid.
- Insert or update a MongoDB document with upsert
Use a stable ID, $set for current fields, and $setOnInsert for creation defaults that should survive later updates.
- Add MongoDB array values without new duplicates with $addToSet
Apply a batch of tags with $each and see which values already existed. Check why existing duplicates remain.
- Find MongoDB points inside a GeoJSON polygon with $geoWithin
Query store coordinates within a service area. Use longitude first, close the ring, and check the returned points in KeplerGrid.
- Enforce per-tenant uniqueness with a MongoDB compound index
Allow the same external ID in two tenants while preventing duplicates within one tenant. Check the combination before building the index.
- Build a compound index for a filter and sort
Choose the field order and verify that the index supplies the sort.
- Find duplicates before creating a unique index
Find repeated values and resolve them before adding a unique index.
Aggregations
- Debug an aggregation pipeline
Compare the documents going into and coming out of each stage.
- Join two collections with $lookup
Match customers to orders and inspect the joined arrays stage by stage.
- Turn joined arrays into rows with $unwind
Get one row per order and keep customers with no orders.
- Group MongoDB orders by day
Count orders and sum totals using UTC or a local time zone.
- Find the latest document per customer
Sort with a tie-breaker and inspect the order each group selects.
- Save and reopen an aggregation pipeline
Save the stages as a file and verify the target before running them.
- Get counts and totals with $facet
Run two summaries on the same input and inspect both results.
- Compute fields in an aggregation
Calculate a Decimal128 line total in the pipeline.
- Filter joined records inside $lookup
Keep only qualifying orders while retaining customers without matches.
- Group numeric values into ranges with $bucket
Check where values at a boundary land and how to handle outliers.
- Combine active and archived documents
Use $unionWith, keep the source label, and sort the combined result.
- Measure date differences with $dateDiff
Count calendar boundaries for BSON dates in the intended time zone.
- Classify documents with $switch
Order the rules, add a fallback, and inspect the labels in the stage output.
- Calculate a running total per customer
Use $setWindowFields and keep the orders in a repeatable order.
- Filter and reshape array elements
Keep selected elements with $filter and transform them with $map.
- Convert mixed field types in a pipeline
Handle invalid and missing values explicitly with $convert.
- Promote a nested document with $replaceWith
Choose which fields to keep and preserve rows with no join match.
- Sum MongoDB array items with $reduce
Calculate one order total from its embedded line items. Return a zero total for empty or missing arrays.
- Get the top N documents per group in MongoDB
Use the $topN accumulator to retain the two largest orders per customer, with a repeatable order when totals tie.
- Fill missing dates in MongoDB with $densify
Generate rows for dates missing from a daily report. Keep a flag that distinguishes generated rows from observed zeroes.
- Sort embedded MongoDB array items with $sortArray
Sort the line items inside each document by price and SKU. Keep one result per order and compare the new order with the original.
- Find shared MongoDB array values with $setIntersection
Keep distinct values that two arrays share. Count the overlap and handle missing lists explicitly.
- Split and clean MongoDB strings with $split and $trim
Turn a comma-separated tag string into a clean array in an aggregation. Handle missing values and remove blank tokens.
- Compare MongoDB rows with the previous value using $shift
Find the preceding reading for each device and calculate the change. Use a stable order for equal timestamps.
- Format MongoDB dates by time zone with $dateToString
Display a BSON date in a chosen time zone while keeping the original date available for filtering and sorting.
- Combine MongoDB documents with $mergeObjects
Apply optional settings over defaults in an aggregation. Check which keys win and how explicit null and nested objects behave.
- Traverse a MongoDB category tree with $graphLookup
Follow parent links through a MongoDB collection, limit the search depth, and inspect the returned ancestors in KeplerGrid.
- Fill MongoDB readings with $fill and carry the last value forward
Fill missing or null readings within each device, keep an original-value marker, and inspect which values were inferred.
- Extract parts of a MongoDB string with $regexFind
Pull a team code and ticket number out of a label. Retain unmatched data for a cleanup review.
- Read MongoDB field names with dots or dollar signs using $getField
Read a literal dotted key separately from a nested path. Use $literal for a field name that begins with a dollar sign.
- Turn MongoDB object keys into rows with $objectToArray
Convert a per-document metrics object into rows with a metric name and value, even when keys vary between documents.
- Inspect a random MongoDB sample with $sample
Choose a few documents at random for a spot check. Put the filter before the sample when you need a specific cohort.
- Read an aggregation Explain plan
Compare query plans and see how many documents and index keys MongoDB examines.
Import and export
- Rename a MongoDB collection safely
Rename a collection within one database in mongosh, then verify its documents and indexes in KeplerGrid.
- mongodump vs mongoexport
Compare a BSON dump and a JSON Lines export of the same MongoDB collection and see what happens to a secondary index.
- Convert a MongoDB BSON dump to JSON Lines
Decode a MongoDB BSON file with bsondump, import its Extended JSON in KeplerGrid, and verify the original BSON types.
- Export a full collection to JSON Lines
Save every document in a collection to an Extended JSON Lines file.
- Copy MongoDB documents to another server
Transfer typed JSON Lines and verify the destination and duplicate IDs.
- Import CSV with explicit BSON types
Map identifiers, numbers, and dates before importing.
- Validate MongoDB writes with $jsonSchema
Require the expected BSON types and test the validator in a practice collection.
- Export all matching MongoDB results
Turn a Documents filter into a pipeline and export every match.
- Preserve BSON types in Extended JSON exports
Check large integers, decimal values, and dates in a Canonical export.
- Export aggregation results to CSV or JSON
Save the full pipeline result directly to a file.
Your first useful query.
Use the desktop app to connect to MongoDB. Start in Read only mode while you explore.
1. Add a connection
Choose File → New Connection. Enter a name and MongoDB URI, choose the environment, and set Connection access to Read only in Options for your first connection. The database in the URI is the initial database.
Remember this connection uses the operating system’s secure storage when available. If it is unavailable, use a session-only connection and keep your own trusted copy of the connection settings. Session-only credentials must be re-entered after the app closes.
2. Open a collection and query
Choose a database and collection. Enter a JSON filter, then run it with Command+Enter on macOS or Control+Enter on Windows/Linux. Sort and projection have separate JSON fields. Use Canonical Extended JSON for exact BSON values.
Find in results searches the loaded page. Paging reads another page; it is not a search across the whole collection. Aggregation and projected results are read only.
3. Stage a change before writing
Enable writes on the connection only when you intend to change data and your MongoDB account has the appropriate permissions. Edit an eligible field or document, then stage it locally.
Review pending changes, choose the documents and commit explicitly. A conflict means the stored document changed since the original read. An unknown outcome means a write may have happened: read back before deciding what to do, and do not blindly repeat it.
4. Import, export and retain evidence
Review a document import before executing it. Review assigns fixed IDs without writing; the explicit Import action submits that reviewed operation.
In the Documents export dialog, Current query page saves the selected page of your query results. Entire collection saves all documents to Extended JSON Lines. For all results of a pipeline, choose Aggregation → Pipeline files → Export full result. Choose Canonical Extended JSON when BSON types matter.
Optionally keep an encrypted import receipt after restart when secure storage and a remembered connection are available. A recovered operation is audit-only and cannot execute or retry, even if it was prepared but never submitted.
5. Quit with your work accounted for
Uncommitted editing drafts last for the current session. Copy important raw text or resolve the drafts before quitting.
Quitting asks about local work, then settles admitted operations. It does not undo database writes already submitted. If an outcome is unknown, retain its evidence and verify the actual database state.
Coming from Robo 3T?
Try the Robo 3T alternative and move one connection to KeplerGrid.
Using Studio 3T?
Compare everyday MongoDB workflows before you switch.