|
In the partial index specification $filter is accepted as well as filter (like lines 105,140 & 141 in index_partial_exists.js does). $filter is also accepted with as many $$$ in front of filter as you can fit. The extra $ are stored in the index spec.
|
> db.coll.ensureIndex({ b: 1, a: 1 }, {$$$filter: { b: { $exists: 1 } } })
|
{
|
"raw" : {
|
"localhost:27018" : {
|
"createdCollectionAutomatically" : true,
|
"numIndexesBefore" : 1,
|
"numIndexesAfter" : 2,
|
"ok" : 1
|
}
|
},
|
"ok" : 1
|
}
|
|
> db.coll.getIndexSpecs()
|
[
|
{
|
"v" : 1,
|
"key" : {
|
"_id" : 1
|
},
|
"name" : "_id_",
|
"ns" : "test.coll"
|
},
|
{
|
"v" : 1,
|
"key" : {
|
"b" : 1,
|
"a" : 1
|
},
|
"name" : "b_1_a_1",
|
"ns" : "test.coll",
|
"$$$filter" : {
|
"b" : {
|
"$exists" : 1
|
}
|
}
|
}
|
]
|
|