# Validating documents in bulk https://www.sanity.io/learn/course/handling-schema-changes-confidently/updating-the-schema-to-match-imported-content.md Check document validation status across a whole dataset. Update schema with missing fields for content that's found in the dataset's documents. Since you have only three document schema types, it’s not that hard to get a sense of what’s going on from looking through the documents. Most projects with some maturity might have a lot of schema types and a lot of content. This is where it becomes useful to use the Sanity CLI to investigate mismatches between your content and the schema that is supposed to describe it. 1. **Run** the following to validate all documents from your terminal ```sh # in apps/studio pnpm dlx sanity@latest documents validate ``` The CLI will give you a small warning about potential pitfalls with this command, if you want to skip this warning in the future, you can run the following: ```sh # in apps/studio pnpm dlx sanity@latest documents validate -y ``` When the command has run, you may have a list of warnings or errors about missing field values: ```sh:Output from the command Validation results: ✔ Valid: 408 documents ✖ Errors: 2 documents, 2 errors ⚠ Warnings: 2 documents, 2 warnings ERROR event 57c1561e-378c-4124-9aa2-88c0db96a037 └─ slug .......................... ⚠ Required └─ current ..................... ✖ Required ERROR event drafts.57c1561e-378c-4124-9aa2-88c0db96a037 └─ slug .......................... ⚠ Required └─ current ..................... ✖ Required ``` This means there is content in your dataset which is not aligned with the validation rules in your Studio schema. In the instance of our error above, there's one document that doesn't have a `slug` field value. 1. You can copy a document ID from the terminal into the search box of your studio to find and fix each document manually. If you had validation errors, and have now fixed them, re-run: ```sh # in apps/studio pnpm dlx sanity@latest documents validate -y ``` And you should see output like: ```sh Validation results: ✔ Valid: 408 documents ✖ Errors: 0 documents, 0 errors ⚠ Warnings: 0 documents, 0 warnings ``` Great! You now have a dataset full of valid content and the skills to ensure validation in bulk as part of future content operations. You are now ready to do the opposite, namely, changing the schema and updating the content accordingly.