[01:55:08] <nicoenarg> hey folks, i'm pretty new to mongodb and trying to figure out this problem that seems pretty easy on RDBMS for me but not sure how to go about it with mongo. I have a project management system where each project can have multiple users and each user can have multiple projects, each user for each project is assigned a projectrole. its this project role relationship that i am having a hard time figuring out because users and projects can
[01:55:08] <nicoenarg> exist without each other as well, i'm a little lost as to how to implement this and also as to how to then read it back efficiently
[01:56:03] <nicoenarg> example read would be: get projects with users and their project roles
[02:47:49] <bros> I have 8m docs in a collection already.
[02:47:52] <bros> What can I do to make this not suck?
[02:48:32] <Boomtime> nice problem description - what sucks exactly? 8 million is nothing
[03:29:24] <Boomtime> are you seriously using a debugger to try to optimize how you use mongodb?
[03:31:55] <Boomtime> .. ok, whatever the heck i'm looking at - what exactly are you observing that sucks? - ignore the profiler/profiling/logs/etc, unless there is a real world effect on something there is no problem
[03:32:17] <Boomtime> if you have a slow query, or you think response times should be faster, etc, let's start there
[03:36:14] <Boomtime> python is in the same bucket, it's data large manipulation is terrible - but that is expected, the language is intended to be easy to write and manipulate module libraries that do the heavy lifting
[03:48:25] <Boomtime> if only you had a version number or a last_update field or something useful like that in your schema - or even just a record of which documents have changed
[03:48:38] <Boomtime> how long is the oplog in production?
[03:59:19] <Boomtime> the writeresult tells you the count of affected documents, and if you don't know ahead of time what documents either will be affected, or have no way of determining the effect after the fact, then either you don't care what the effect is or the effect is meaningless by definition
[03:59:46] <bros> I think a document hash would be extremely cool
[03:59:57] <Boomtime> yes, that would actually be useful
[04:00:41] <Boomtime> i think i've wanted a document hash before.. imma check if there is a feature request for it
[04:03:18] <bros> Boomtime: could I do it client side?
[04:03:25] <bros> It just gets awkward with updates/upserts, etc.
[04:06:46] <bros> might this be better served for a server side javascript function? hmm
[04:10:28] <sector_0> I'm defining a user model using the mongoose client for node, and I'm defining a userID field, should I simply merge the _id field with the userID field and make them one and the same thing?
[04:10:36] <sector_0> or would this pose a security risk?
[04:13:30] <bros> I could have a collection called "hashes"
[04:13:49] <bros> With the following fields for each document: document_id, new_version_hash, old_version_hash
[04:13:58] <bros> On every write, make sure new_version_hash stays up to date
[04:14:16] <bros> Then, would I do an aggregation or a map/reduce to find the differing docs?
[04:15:24] <sector_0> p.s. the user would be able to see his/her own id, as well as other users
[04:15:48] <sector_0> ...not publicly, but it would get passed around to clients
[04:37:51] <Boomtime> @bros: if you're going to change your schema, then add an updated field - if you only want the field changed if certain fields are changed, then add those fields to the predicate for update
[04:38:15] <bros> updated isn't invulnerable to the "the timestamp changed, but the hash most likely didn't" which probably plagues my app
[04:41:02] <Boomtime> now it only changes documents whose status wasn't already 'cool'
[04:42:04] <Boomtime> you are in control of the predicates - by definition you know ahead of time what is about to change, so make your predicates depend on what you're about to change to know if a change is about to happen