skip to content
Alvin Lucillo

Validate indexes

/ 1 min read

To validate collection data and indexes to look for inconsistencies, you use the validate function.

db.users.validate({full: true})
{
  ns: 'test.users',
  uuid: UUID('3f291365-864e-43d6-936a-cb74f8b34a0a'),
  nInvalidDocuments: 0,
  nNonCompliantDocuments: 0,
  nrecords: 1,
  nIndexes: 1,
  keysPerIndex: { _id_: 1 },
  indexDetails: { _id_: { valid: true } },
  valid: true,
  repaired: false,
  warnings: [],
  errors: [],
  extraIndexEntries: [],
  missingIndexEntries: [],
  corruptRecords: [],
  ok: 1
}