performance - Speed up search -
i have collection around 2.5million records. i'm using nodejs mongoose. i'm open suggestions improve efficiency of current search.
artist collection schema that:
var artist = new mongoose.schema({ realname: string, names: array }); user passes string example: michael jackson contacted police or michael jackson-jillie bean. have find artist/singer/person logical thing find was: iterate through documents in collection, check if of names in given string if yes have match -> stop loop.
but memory inefficient since has load whole collection memory nodejs can iterate through , check records.
it seems retrieving whole collection takes of time. way speed up? in mongoshell db.collection.find() pretty fast. using mongoose in nodejs takes waaay long.
- why .find() slow used mongoose?
- are there other databases designed purpose?
- how solve problem more efficiently?
- could map reduce use here?
what need full-text search. possible options:
- use mongodb
textindex. (new in 2.4) - use addition full text index. in opinion elasticsearch performant , easy understand beginners.
Comments
Post a Comment