To enable unique index in node I do:
City.native(function(err, collection) {
collection.ensureIndex({
'name': 1,
}, function(err, result) {
//nothing
});
});
But I would like to enable text index on name also. So after doing the above I do:
City.native(function(err, collection) {
collection.ensureIndex({
'name': 'text'
}, function(err, result) {
//nothing
});
});
This perfectly creates both indices. My question is, is there any chance to merge this code?? I tried with
City.native(function(err, collection) {
collection.ensureIndex({
'name': 1,
'name': 'text'
}, function(err, result) {
//nothing
});
});
but this creates just the text index.