Everyday workflows

Querying documents

Use Source, Visual and Chips filters, BSON values, server sorting, projection and paging.

Choose a filter mode

Query tabs provide three views of a MongoDB filter:

  • Source accepts a BSON object expression. Use it for complex filters or expressions that visual controls cannot represent.
  • Visual builds conditions and groups using controls for fields, operators and values.
  • Chips presents conditions as compact, editable chips.

Choose available modes and the default for new editors under Settings → Queries. If a filter cannot be converted, keep it in Source and correct it there. Switching modes does not run the query.

Write a filter

The Source editor takes the filter object, not a complete db.collection.find(...) command. An empty object {} matches all documents. Use your actual field names in these examples.

Equality and numeric comparisons

{ status: "pending", total: { $gte: 100 } }

Multiple alternatives

{ $or: [{ status: "pending" }, { priority: "high" }] }

Nested fields and regular expressions

{ "customer.address.city": "London", name: /^Acme/i }

Dates and typed identifiers

Filter a date using an explicit timezone:

{ createdAt: { $gte: ISODate("2026-01-01T00:00:00Z") } }

Find an ObjectId:

{ _id: ObjectId("507f1f77bcf86cd799439011") }

Match a standard UUID:

{ customerId: UUID("00112233-4455-6677-8899-aabbccddeeff") }

Match an exact 64-bit integer beyond JavaScript's safe integer range:

{ sequence: Long("9007199254740993") }

Constructor syntax preserves BSON types. A string containing an ID is different from an ObjectId or UUID. For legacy UUID storage (binary subtype 3), use LUUID("...") with your preferred representation, or explicitly choose CSUUID("...") (C#), JUUID("...") (Java) or PYUUID("...") (Python). Lowercase legacy helper names are also accepted. These are not interchangeable with standard UUID("...") (subtype 4).

Palryn parses a constrained BSON syntax; it does not evaluate arbitrary JavaScript in query fields. Use Shell when you need a full script.

Match an MD5 digest

{ digest: MD5("d41d8cd98f00b204e9800998ecf8427e") }

MD5() and md5() encode an existing 32-digit hexadecimal digest as binary subtype 5. Uppercase hex is accepted and displayed in lowercase. The helper does not hash text: MD5("hello") is invalid. A subtype-5 digest is different from a string containing the same hex or identical binary bytes with another subtype.

Relative date shortcuts

Enter unquoted # shortcuts wherever a date value belongs in a Source filter. Names are case-insensitive; type # to see suggestions. Each shortcut resolves to a BSON date when the query is parsed for a run, using your computer's clock. All calendar boundaries use UTC, matching the date picker. Filters containing shortcuts stay in Source mode so conversion to Visual or Chips cannot freeze them into fixed dates.

{ createdAt: { $gte: #Today, $lt: #Tomorrow } }
{ createdAt: { $gte: #Last7Days, $lt: #Now } }
{ dueAt: { $gte: #ThisMonth, $lt: #NextMonth } }
ShortcutDate value
#NowCurrent instant, to millisecond precision.
#Yesterday, #Today, #TomorrowMidnight at the start of that UTC day.
#LastWeek, #ThisWeek, #NextWeekMonday at midnight at the start of that UTC calendar week.
#LastMonth, #ThisMonth, #NextMonthFirst day of that calendar month at midnight UTC.
#LastYear, #ThisYear, #NextYearJanuary 1 of that year at midnight UTC.
#Last7Days, #Next30Days, #Last24HoursA rolling offset from now, preserving time of day. Use #LastNUnit or #NextNUnit, replacing N with any positive whole number in the supported timestamp range and Unit with Second(s), Minute(s), Hour(s), Day(s) or Week(s). Days are 24 hours and weeks are seven days.

Shortcuts are date boundaries, not whole-period filters: { createdAt: #Today } matches exactly midnight. Use $gte and an exclusive $lt upper boundary to select a period. Quoted "#Today" stays a string. Values are resolved again when a new query or export starts; fetching more batches from an existing cursor keeps its original boundaries. Saved Source text retains the shortcuts. Shell uses MongoDB's own JavaScript syntax and does not expand these Palryn shortcuts.

Sort and select fields on the server

Server sort orders matching documents before paging. Use 1 for ascending or -1 for descending:

{ createdAt: -1, _id: 1 }

Server projection chooses fields returned by MongoDB:

{ customerId: 1, status: 1, total: 1 }

Use inclusion or exclusion flags, with MongoDB's usual _id exception; this editor does not support arbitrary projection expressions. An empty projection {} returns complete documents.

Projection versus columns: hiding a table column only changes the display. Server projection removes fields from the returned document. Use an empty projection and rerun before editing, deleting or duplicating a full document.

Run, stop and page

Choose Run query or press Ctrl/Command + Enter in the editor. Page size controls the requested number of rows on each page. First, Previous, Next and Last move through matches when those actions are available.

Palryn also applies a result-size budget from Settings → Queries. A page can stop at that budget before reaching its requested row count. The notice explains why loading stopped; reduce fields with a projection, narrow your query, or move to the next page.

Stop ends the current loading session. Results already displayed remain available. If a session expires or the connection changes, rerun the query for fresh results. Query results are not a transactionally frozen snapshot of a collection that other clients are modifying.

Inspect collapsible JSON

JSON opens a read-only source viewer with the same object/array folding controls as the BSON editor. Use the gutter arrows or the compact Collapse all and Expand all buttons inside the editor's top-right corner. These controls stay above the scrolling text in every shared source editor.

The Format dropdown defaults to BSON constructors and also offers Readable Extended JSON and Canonical Extended JSON. Your choice is remembered across tabs and restarts. Readable mode uses normal document fields and plain numbers where safe, with MongoDB wrappers for values such as ObjectIds, dates, decimals and binary data. Integers outside JavaScript's safe range keep $numberLong wrappers to avoid rounding. Canonical mode makes all BSON numeric types explicit, using wrappers such as $numberInt, $numberLong and $numberDouble; dates use epoch milliseconds. Choose Canonical when exact numeric types matter.

The viewer shows the same documents as Documents on the current result page, in the same order, as one JSON array, including local edits. Use the normal query pager to load another page. The JSON viewer adds no character-count, value-count or nesting-depth restrictions to the loaded result page.

The default format, BSON constructors, shows typed values as readable helpers rather than Extended JSON wrappers:

[
  {
    "id": UUID("00112233-4455-6677-8899-aabbccddeeff"),
    "legacyId": CSUUID("00112233-4455-6677-8899-aabbccddeeff"),
    "digest": MD5("d41d8cd98f00b204e9800998ecf8427e")
  }
]

Legacy UUIDs use CSUUID, JUUID or PYUUID according to Settings → Documents → Legacy UUID representation. Each explicit helper preserves the stored bytes when copied elsewhere. Dates, ObjectIds, numeric types and other BSON values use their corresponding constructors; generic binary values still use BinData. This is Palryn BSON expression syntax, not strict JSON. Copy a single object into a document editor, or save the complete copied array for document import. The format choice is remembered.

Copy to clipboard in the editor toolbar copies the complete current source, including collapsed content, in the selected format. The toolbar confirms success or lets you retry a failed copy. This button also appears in BSON and Shell source editors and copies their current text, including unsaved edits. You can still select and copy smaller portions normally.

Autocomplete and result shortcuts

Suggestions include operators, BSON helpers and field names sampled from loaded documents. Press Ctrl/Command + Space to request suggestions, use the arrow keys to select, and Tab to accept. Missing suggestions do not mean a field is absent from the collection.

Right-click a result property to add a matching or excluding filter condition when available. The value's BSON type is retained. Review the resulting filter and run it explicitly.

Export a query

The Export query results… action uses the last executed filter, sort and projection. It exports all matching server documents, not just the current page. Unsaved local document edits are not included. See Export documents for formats and file handling.

Palryn · Explore your data.
These guides describe Palryn v0.7.0. Available controls may differ in older versions.