user.rb
5.67 KB
-
Try plucking instead of mapping. · e9435879
Use pluck instead of map for upvoted/downvoted IDs. Mapping involves doing the projection locally, whereas plucking will ask MongoDB to do the projection for us. This is the difference between sending the whole document back and sending back the ObjectId itself. Multipled against hundreds or thousands of documents, mapping can really add up, so plucking should really help these 99%'ile cases.
Toby Lawrence committed