Two hundred and forty documents found, then renamed
Describe the audit in English. A companion writes the GROQ, returns the count with the ids behind it, and dry-runs the rename before a single document changes.
Somebody asks how many articles still reference the old product name. The CMS has eleven hundred documents across four types, and the Studio search box was built for finding one thing rather than counting a thousand.
A companion answers it in a minute. You describe the audit in English, it writes and runs the GROQ with values passed as parameters, and returns the two hundred and forty matches grouped by type, with ids and titles attached so you can spot-check the number before you act on it.
Count every document that mentions the old name
Eleven hundred documents filtered to the two hundred and forty that mention the old name, grouped by type, with ids and titles listed. Parameters are passed properly rather than pasted into the query text, which is what keeps a client name with an apostrophe from breaking the query.
The output is a number with its evidence attached. If the number looks wrong, the documents behind it are one click away.
What does a safe mutation look like here?
It starts as a dry run.
The mutation tool takes a dryRun flag that validates without committing, so renaming a product across two hundred and forty documents is something you read before it happens.
Then a second gate. Deletes, replaces and destructive patches require an explicit confirmation flag set only after you have approved, so a delete cannot slide past you inside a longer batch of edits. Mutations group into one transaction, so a half-applied rename is not one of the outcomes.
- Dry run first: validate the mutation, read what it would change, then commit.
- Create, createIfNotExists, createOrReplace, patch and delete, in one call or many.
- Destructive operations need a separate confirmation flag, set only after approval.
- Parameterised GROQ, so values are never interpolated into the query string.
Which dataset are you pointed at?
A companion lists the datasets and their visibility before it writes, and names the one it is about to mutate in the plan. Ask for the audit against production and the rename against staging, and check the name before you approve.
The stronger control sits at connection time: give the connection a token scoped to what the job needs. A content audit needs read. A staging rename needs write on staging. That decision is made once and outlasts every individual approval.
Rank the pages worth rewriting
Pull the analytics for each article from the tool you are signed into, join it to the GROQ result, and produce the ranked list of thirty pages worth rewriting. That is ordinary research work where the CMS is one source among several.
Inside Sanity the shape is documents: query them, read them by id, mutate their fields and references. Compare it with the Webflow surface, where creation is the only write.
Experience Strawberry for free
DownloadTrusted by fast-growing companies worldwide
Frequently asked questions
Strawberry is free to download and includes AI credits to start. Paid plans begin at $20/month. See pricing. · Reviewed · Canonical facts for AI agents