I am working on a existing Java J2EE application , which is using Mongodb very extensively .
The Application has got some scripts .sh files (bash files ) which runs daily at some point of time whose responsibility is to execute mongoexport command as shown below
mongoexport --csv -o /tmp/people.csv -d school -c people -f firstName,lastName,telephone,email
My question is that , do i need to create indexes on the collection named people for the fields firstName,lastName,telephone,email
Will this add any advantage on mongodb ?? Or creating indexes on these fields is not necessary at all ??
So please let me know
Should we create indexes for the fields which are part of mongoexport command ?
The mongoexport
will run in O(N) time (with or without an index) because you're exporting all the records in the collection (e.g. requires a scan on the collection). As mentioned in a comment, indexes are only needed to speed up searching, sorting, and maybe aggregations.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments