[06:51:18] <noobie25> i can't seem to wrap my head around this: if i have a collection called: "comments" and in comments, i embed ObjectId's for a items in my User's collection ... how do i query Comments such that the User Obect Id's are already expanded?
[06:51:51] <noobie25> it seems, i have to do multiple queries on the User's ObjectId's ... which i don't want.
[06:57:28] <crudson> noobie25: correct. Or use a framework that will understand references between documents (mongomapper et. al.). This leads to another question, do you always want to expand Users, or at the time when you need that information? (see lazy loading)
[06:58:49] <noobie25> crudson: i'm in a situation, where i always need to expand the user. for example, if a user has decided to change his profile picture, i'd like this change to be available.
[07:01:58] <noobie25> crudson: maybe there is a different way to model I haven't seen yet? Basically, ... i have multiple posts (being shown) and would like to load their comments along with user id .. without requiring N*M queries (N comment * M Users per comment)
[07:03:30] <crudson> noobie25: you can't ask for documents to be dereferenced in a single query. For your options see http://docs.mongodb.org/manual/applications/database-references/
[07:04:33] <crudson> noobie25: it could be a data modeling issue, or a caching one for instance
[07:05:03] <crudson> noobie25: retrieving someone's avatar could be helped by the latter for example
[07:05:47] <noobie25> crudson: how would you model say a Post, Comment, and User? I would like to show multiple Posts on a page.
[07:06:01] <noobie25> crudson: thx for you help by the way. thought it was quiet in here.
[07:10:55] <crudson> noobie25: no probs. It seems sensible to me to embed comments within posts but keep users separate.
[07:13:56] <noobie25> crudson: thx for helping out. i'm looking into mongomapper right now.
[07:14:04] <crudson> noobie25: and pay careful attention to not return comments when you don't need them, and only the subsets of comments as you wish. http://www.mongodb.org/display/DOCS/Retrieving+a+Subset+of+Fields
[07:14:45] <crudson> nothing helps you learn it better than doing it manually on a small scale to start with :)
[09:33:01] <Gargoyle> yud1z_: Alternatively, you could store your stream entries in a separate collection. Obviously depends on what works best for your schema
[09:33:52] <yud1z_> so, that is not the rich document?
[09:34:52] <Gargoyle> That's one way of putting it - but there's obviously a balance to be made between fully rich docs, and the performance of doing that kind of processing.
[09:36:26] <Gargoyle> We have batch jobs that take 45 mins and gobble 2gb of ram. but that fits in with our needs!
[09:36:48] <yud1z_> oh .okey, so and if i separate coleection of stream, what if i make document inside it, for example i make for comments. i separate again?
[09:40:52] <lqez> yud1z_: you can calculate the size of BSON with http://bsonspec.org/#/implementation
[09:42:13] <yud1z_> yeah, i just thinking, how the model is, separate, and make it scalable
[09:43:13] <lqez> I think mongo does not separate an object into pieces.
[09:44:06] <kali> ilyak: you cal also generate a few typical documents with your favourite language and use the bson library to generate the binary version and check it out
[10:13:19] <kali> ilyak: look at the driver classes, the one responsible for transforming BSONObject into binary data should be quite easy to spot
[10:13:32] <kali> ilyak: BSON.encode in the java driver for instance
[10:55:03] <chutsu> Hello, I'm having problems with "Error: getMore: cursor didn't exist on server, possible restart or timeout? src/mongo/shell/query.js:113"
[10:55:18] <chutsu> I was perfroming an update over all documents
[13:20:35] <mischat> ah yes, so I saw mention of the project where "find ( {bar : {$gt > n}, {"foo : 0"} ) online, but the ability to have a "1" in the projection is what I was looking for.