node.js - Mongo DB - What should I put to indexes? -
i have query .sort() , .select():
item.find({title: searchregexp}).lean().select('slug title poster').limit(50).sort('-_id') should put mongodb indexes:
- query fields
{ title: 1 } - sort fields
{ _id: -1 }) - select fields
{ slug: 1, title: 1, poster: 1 }
or them together? { title: 1, _id: -1, slug: 1, title: 1, poster: 1 }
Comments
Post a Comment