> db.dropDatabase()
|
{ "dropped" : "test", "ok" : 1 }
|
> db.foo.ensureIndex({a:"text"})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.insert({a:"hello world"})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.validate().keysPerIndex
|
{ "test.foo.$_id_" : 1, "test.foo.$a_text" : 2 }
|
> db.stats().dataFileVersion
|
{ "major" : 4, "minor" : 6 }
|
> db.repairDatabase()
|
{ "ok" : 1 }
|
> db.stats().dataFileVersion
|
{ "major" : 4, "minor" : 5 } // incorrect: wrong version
|
> db.foo.validate().keysPerIndex
|
{ "test.foo.$_id_" : 1, "test.foo.$a_text" : 2 } // correct: two text index entries
|
> db.foo.insert({a:"hello world"})
|
WriteResult({ "nInserted" : 1 })
|
> db.foo.validate().keysPerIndex
|
{ "test.foo.$_id_" : 2, "test.foo.$a_text" : 3 } // incorrect: treated as ascending index (only one key added)
|
>
|