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 text index. (new in 2.4)
  • use addition full text index. in opinion elasticsearch performant , easy understand beginners.

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -