Try plucking instead of mapping.
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.
Showing
spec/models/user_spec.rb
0 → 100644
Please
register
or
sign in
to comment