Hacker News new | past | comments | ask | show | jobs | submit login

> You sometimes want to just get the blog post object too, not all the comments.

I feel this should be clarified a bit (since you most likely have a more complicated scenario in mind) but it is entirely possible to only select certain fields to be returned from a query. So if a 'comments' document was inlined within a 'post' document, we could easily opt to only have the latter returned by mongod. Such a query might look like this:

    db.posts.findOne( {'_id' : <...>}, { comments:0} );
This would definitely cut down on the amount of data transferred over the wire, but I am not sure if there is any performance hit within mongod.



Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: