I am creating an android application and I am using nodeJS with mongoDB on the server side, now in fact I still encoded everything in development, but now I want my application to be in production, now that I read the documents on the mongoose, they wrote that:
When the application starts, Mongoose automatically calls securityIndex for each specific index in your schema. Although this is good for development, it is recommended that this behavior be disabled during production, since creating an index can produce significant results. Disable the behavior by setting the autoIndex parameter of your schema to false
Now can someone tell me what it is, I mean, I have fields that I have indexed now, why disable autoIndex, I do not index each field only some of them, I also saw this question before on StackOverflow . but no one explained it in detail, I read the answers here
Mongoose indexing in production code
Mongoose call sureIndex at startup, but this is not recommended. So why is it the default?
Another question that I just wondered, since all my indexes are in my mongoDB , so what should I use to describe them even at the schematic level, I mean that every time every CRUD every thing happens in the database and on at the database level, we defined all the indices, so why should we index them again at the schema level, please answer, I'm very new to this, so for some reason I don’t know how much this is known, I know that I don’t have enough then a large piece of the puzzle, but it would be very useful if someone could talk about it.
source share