0
votes

Actually I'm a complete beginner in mongodb so please do excuse me if my question is foolish or off-topic . Basically I'm storing user_information in a collection then I'm performing search operation by fullname field (it's not unique) . I've just read about indexing the mongodb fields to increase the performance . So, what I'm asking is ** Can or should I index the fullname field for getting faster result ?**

My Query for getting result in nodejs:

var regex = new RegExp(["^", string].join(""), "i");//string is received from user
db.collection("user_information").find({ fullname: regex },{_id:0}).toArray(function(err, result) {
if(err) throw err;
console.log(result);

});
1

1 Answers

1
votes

Yes, indexing would help you to increase the search operations. You can refer the documentation here