Help › Work with results
Edit MongoDB documents
Change and remove fields in the results, edit a whole document as JSON, add and delete documents, and how each value keeps its type.
Querlyn 0.1.0 is not released yet. This help describes it ahead of release.
On a MongoDB connection you can change documents straight in the results,
as you change rows on other databases; see Edit rows in a result.
Nothing reaches the server while you edit: your changes are collected,
Show Changes shows the statements they become, and Apply sends
them. Each change is one statement for one document, found by its _id.
When documents can be edited
The line above the grid says Editable and the collection, or Read-only and why. Documents can be edited when all of this holds:
- They come from a
findon one collection, such asdb.orders.find({ status: "open" }), with any filter, sort and limit. The documents of anaggregate, of a view or of a command are read-only: edit them with afindon their collection. - The result includes
_id. A projection that leaves_idout makes the result read-only. - The connection is not read-only.
Within an editable result:
_idcannot change. It is what finds the document. To give a document another_id, insert a copy and delete the original.- A document without
_id, or whose_idanother document of the result has too, cannot be changed from the grid; the row says why. - A field the projection computes, such as
{ total: { $sum: … } }, is not a field to write.
Change a field
Edit a cell as on any database (,
↩ on macOS or F2 on Windows and Linux, or a double-click). The change becomes
updateOne({ _id: … }, { $set: { field: value } }).
Every value keeps its type. What you type is read as the type the cell already has, so editing never changes a field's type by accident:
| The field is | You type | It stays |
|---|---|---|
an int | 42 | an int; a number too large for 32 bits is refused |
a long | 42 | a long, also when it is small |
a double | 1.5 | a double |
a decimal | 100.50 | a decimal, exactly as typed |
| a string | 42 | the string "42" |
| an ObjectId | 24 hexadecimal digits | an ObjectId |
| a date | 2026-10-09T08:30:00Z | a date |
To change a field's type, write the value in the shell's syntax:
NumberLong("5"), NumberInt(5), Double(5), NumberDecimal("5"),
ObjectId("…"), ISODate("…"), or a string in quotes, "5". Querlyn
never turns a 64-bit integer into a double, so large numbers stay exact.
An embedded document or an array is typed as JSON in its cell, or edited
in the larger editor ().
With Flatten on, a column such as address.city edits that field of
the embedded document; see
Connect to MongoDB.
Remove a field
A field a document does not have is different from a field that holds
null, and the grid keeps them apart: a missing field is an empty cell,
null is NULL.
- NULL () stores
nullin the field. - Missing removes the field from the document (
$unset). Choose Missing in the bar above the grid while you edit a cell, or select cells and choose in the grid's menu.
Edit a whole document as JSON
To change many fields at once, or a document whose fields the columns do not show (the Other fields column), edit it whole:
- Put the cursor on the document and choose JSON in the bar above the grid, Edit as JSON in the record view, or . Querlyn reads the document from the server first, so you edit it as it is now, with every value's exact type.
- Edit it in the larger editor. It is shown as relaxed Extended JSON,
with each 64-bit integer written
{ "$numberLong": "…" }so it stays along. Show Canonical shows every value's type in full; Show Relaxed goes back. - What you type is checked as you go: it must read as one document and
keep its
_id. The reason shows under the editor until it does. - Choose Keep. The document is replaced as a whole when you apply
(
replaceOne({ _id: … }, …)).
Add and delete documents
- Add in the bar above the grid ()
adds an empty document;
adds copies of the selected ones without their
_id. Fill in the fields you want: an empty cell is left out of the document. Without an_id, the server gives the document one. Each becomesinsertOne(…). - Delete () marks the selected
documents; each becomes
deleteOne({ _id: … }).
Review and apply
Changed cells, new documents and deleted ones are marked in the grid until you apply or revert them.
- Show Changes ()
shows the statements, in the shell's syntax, for example
db.getSiblingDB("shop").getCollection("orders").updateOne({ _id: ObjectId("…") }, { $set: { status: "paid" } }). - Apply (⌘S on macOS or Ctrl+S on Windows and Linux) sends them in order. On Production Querlyn asks first; a read-only connection refuses. See Confirm risky statements.
- drops them.
If a change matches no document, it was deleted or its _id changed
since the query ran: Querlyn says so, keeps the change pending, and you
can run the query again to see the documents as they are now.
Each statement is listed in the statement console with its values by reference, never in the text; see Watch what Querlyn sends.
Changes and transactions
On a replica set or a sharded cluster, a tab that commits by hand (a Production connection starts that way) applies the changes inside its transaction: they are kept only when you commit. MongoDB rolls back a transaction left open longer than its limit, 60 seconds by default, so the bar above the editor counts down, Commit within 40 s, until you commit; choosing it commits. See Commit and roll back changes.
On a single server, each change takes effect when it is applied.
Help for Querlyn 0.1.0. All help topics