Browse documentation
MongoG GuideVerified with mongodb 7.5.0

Browse and Edit Documents in MongoG

Use MongoG’s collection workspace to filter, page, inspect, insert, replace, and delete BSON documents with concurrency and read-only safeguards.

Open a collection workspace

Select a collection in the Explorer or choose Open Documents from its context menu. MongoG opens a persistent workspace locked to that connection, database, and collection. The lock prevents an editor context change from silently sending a document operation to another namespace.

The workspace has two complementary surfaces:

  • Documents browses data with bounded filters, projections, sorting, and paging.
  • Query runs driver scripts while retaining the collection context and schema-aware completions.

Use Documents for visual inspection and deliberate single-document edits. Use Query when a reproducible script, aggregation, bulk change, or transaction better expresses the work.

Filter without loading the collection

Open the Documents criteria panel and enter Extended JSON objects. A filter narrows matching documents, a projection controls returned fields, and a sort controls order.

Filter:

{ "status": "active", "createdAt": { "$gte": { "$date": "2026-01-01T00:00:00Z" } } }

Projection:

{ "name": 1, "status": 1, "createdAt": 1 }

Sort:

{ "createdAt": -1, "_id": 1 }

The criteria editors accept Extended JSON because plain JSON cannot preserve types such as ObjectId, Date, Long, Decimal128, or Binary. Invalid or non-object input is rejected before a database request runs.

Add a stable secondary sort key such as _id when deterministic ordering matters. Deep offset pagination is still a server concern; for application endpoints with very deep pages, use an indexed range filter instead of repeatedly skipping records.

Understand bounded paging

MongoG does not call toArray() on a collection cursor. The connection runtime advances the real cursor with next() and sends one bounded page of Extended JSON data to the interface.

Next and Previous navigate retained cursor pages. Refresh closes the old cursor and runs a new read, so refreshed results can reflect database changes. Closing the tab also releases its cursor ownership.

If a document is larger than the normal payload bound, MongoG shows an explicit full-value action backed by an opaque handle. This keeps ordinary page navigation responsive without silently truncating the stored BSON value.

Insert a BSON document

Choose the insert action and enter Canonical Extended JSON. For example:

{
  "name": "Workspace tutorial",
  "status": "active",
  "price": { "$numberDecimal": "39.90" },
  "createdAt": { "$date": "2026-09-01T09:00:00Z" },
  "tutorial": "collection-workspace"
}

MongoDB generates _id when it is omitted. MongoG preserves BSON types as data across the editor boundary; it does not stringify a decimal or date into an ordinary JavaScript value.

For an application collection, review schema validation, unique indexes, and required fields before inserting. The visual editor is not a substitute for the collection’s correctness rules.

Replace an existing document safely

Editing an existing record performs a full document replacement. Keep every field that must remain, because fields omitted from a replacement are removed. _id is mandatory and immutable.

MongoG uses an optimistic filter containing both the document identity and the exact value that was loaded. If another writer changes the record before you save, MongoG reports a stale-document conflict instead of overwriting the newer version.

When a conflict occurs:

  1. Dismiss the error without copying over it blindly.
  2. Refresh the collection to load the current document.
  3. Compare the current value with your intended edit.
  4. Reapply only the changes that are still correct.

Projected documents cannot be edited because a replacement based on incomplete fields would accidentally discard unprojected data. Remove the projection, reload the full document, and then edit.

Delete with confirmation

Delete is an explicit confirmed action. MongoG again includes the loaded document in its optimistic filter, so a concurrently modified record fails as stale rather than being deleted from an outdated view.

Before deleting application data, confirm the namespace, _id, tenant boundary, and whether dependent records need their own cleanup. MongoDB does not automatically cascade deletes between referenced collections.

For deleting many records, use a reviewed query script: display or count the exact filter, run the delete statement separately, and verify the remaining state. A bulk maintenance operation should not be disguised as repeated single-document clicks.

Use read-only profiles

A read-only MongoG profile disables document mutations in the interface and rejects them again in the main process before they reach the runtime. This reduces accidental writes from an everyday inspection profile.

MongoDB roles remain authoritative. Use a server user with read-only roles when the connection must never write. A client-side read-only setting cannot replace database authorization, and no best-effort script scanner can prove arbitrary code is harmless in every case.

Move between Documents and Query

The Query view is useful when the visual criteria become difficult to explain. The equivalent driver query is explicit and reusable:

const collection = db.collection("your_collection");

collection.find(
  { status: "active", createdAt: { $gte: ISODate("2026-01-01") } },
  { projection: { name: 1, status: 1, createdAt: 1 } },
).sort({ createdAt: -1, _id: 1 });

The returned cursor uses the same paged result infrastructure. Choose the surface that makes the operation easiest to review, not the one with the fewest keystrokes.

Practice workflow

In the mongog_tutorial database, create a workspace_items collection with a query script and then practice the visual workflow:

  1. Open Documents and filter to { "tutorial": "workspace" }.
  2. Sort by createdAt descending with _id as a tie-breaker.
  3. Insert a document containing a Decimal128 price and Date.
  4. Reload the complete document and change its status.
  5. Open Query and verify the BSON types with findOne().
  6. Delete only the tutorial record after confirming its _id.

Common mistakes

  • Entering JavaScript helper syntax in a criteria box that expects Extended JSON.
  • Editing a projected document as if it contained the full stored record.
  • Assuming replacement merges omitted fields; replacement removes them.
  • Retrying a stale edit without first reviewing the newer database value.
  • Treating Previous as a rerun of the query instead of navigation through retained pages.
  • Treating MongoG’s read-only profile as a replacement for MongoDB roles.

Continue learning

Use the query editor for repeatable multi-document work, then explore MongoG administration tools for indexes, explain plans, change streams, search, and GridFS. The official driver guide documents query and cursor operations.