sanity icon indicating copy to clipboard operation
sanity copied to clipboard

Migration run executed with an error [Mutation failed: Syntax error, unable to parse entire expression]

Open lotarbo opened this issue 6 months ago • 0 comments

Hello. I want to run a migration to remove a non-existent field from documents. But it fires with an error. Error: Mutation failed: Syntax error, unable to parse entire expression

This is my migration

import {defineMigration, at, unset} from 'sanity/migrate'

export default defineMigration({
  title: 'remove text field from blockInvestmentObjective',
  documentTypes: ['page'],

  migrate: {
    document(doc, context) {
      return [
        at("blocks[_type == \"blockInvestmentObjective\"].text", unset())
      ]
    },
  },
})

command sanity documents validate returns this image

my structure looks like this page->blocks->array ob page blocks

lotarbo avatar Feb 20 '24 13:02 lotarbo