I have a 1.6GB collection that basically have 2 data: nombre
and documento
.
The document has this structure:
{
"_id": ObjectId("5a6ba42850c4631898754a06"),
"nombre": "Jorge",
"documento": "4918273627"
}
I look for them by documento
and return the nombre
.
My question is if there is a way to optimize it so that the results appear faster, because the query takes a long time and I understand that this type of database is much faster than relational.
The query I do with Mongoose in NodeJS and it is as follows:
MongoDB.collection('datos').findOne({ 'documento': { $regex: new RegExp("^" + documento.toLowerCase(), 'i') } }, function (error, ok) {
Thanks for your contributions.