Does MongoDB createIndexes() method, support specifying individual options for each index set in the script. Something like this below, which is not working by the way.
var indexes = [
{
key: { "productId":1, "productName":1 },
partialFilterExpression: { "catalog": { $exists: true} },
name:"productId_productName_catalog_partial"
},
{
key: { "productId":1, "createdDate":1 },
sparse: true,
name:"productId_createdDate_only"
}
];
db.product.createIndexes(indexes);
Error
{
"message" : "Error in specification { key: { key: { productId: 1, productName: 1 }, partialFilterExpression: { catalog: { $exists: true } }, name: 'productId_productName_catalog_partial' }, name: 'key_[object Object]_partialFilterExpression_[object Object]_name_productId_productName_catalog_partial' } :: caused by :: Unknown index plugin 'productId_productName_catalog_partial'",
"ok" : 0,
"code" : 67,
"codeName" : "CannotCreateIndex"
}