[01:28:41] <Zelest> I don't get how the PHP drivers work..
[01:29:08] <Zelest> The replicaset thingie makes no sense
[01:29:36] <Zelest> What's the point of replication if everything breaks as soon as a single slave node dies? :/
[01:30:06] <Zelest> Why does the PHP driver connect to all nodes (and if one is down, it has to timeout) even when the readpreferences is set to master only?
[01:46:21] <ackspony> Zelest, is that replication or sharding
[01:58:50] <Zelest> might have configured something backwards.. but nothing I know of that can affect that.. :/
[02:06:48] <ackspony> what's the simpliest syntax to dereference a singleton array
[03:15:13] <ackspony> i'm having issues understanding how to apply sort() to a .map output
[03:22:34] <danlamanna> anyone know where i can get an example similar to http://cookbook.mongodb.org/patterns/pivot/ but applying to two collections (one referencing the other by _id) ?
[03:26:36] <ackspony> dan, i believe that's jst a 'map'
[03:28:25] <danlamanna> i just have 2 collections, users and items, users has a field named items as an array (reference based one to many) - and i just want to get a collection for user foo that contains the items embedded
[06:45:48] <Nilshar> I got 2 mongodb 2.2.0 clusters, on both, when I check rs.status() the primary says : "maintenanceMode" : -4 or on other cluster : "maintenanceMode" : -6 I didn't find anything to explain what is that "maintenanceMode" and the values in the doc. maybe someone can point me some doc about it ? (upgrade to 2.4 is planned, but will take a few time... :) )
[07:20:47] <dforce> Can someone help me with mongodb and pymongo regarding ObjectIds ?
[07:25:58] <ron> dforce: general rule of irc. don't ask to ask. just ask your question and wait patiently for someone to reply.
[07:30:40] <dforce> Iam using pymongo as a driver between mongodb, python and django (web framework). I am having 2 collections within a mongodb. The first collection is a general collection where for one field has ObjectIds ($oid) refering to objects in the second collection. How can I get the content of the second collection when querying the field with those ObjectIds in the first collection ?
[07:35:04] <Nodex> dforce : Mongo doesn't do relationships or joins. If your driver supports them you will need to look in thier docs for "dbRef"
[07:35:56] <Nodex> some drivers/ODMS/ORM's support looking these up for you without -your script- needing to do a second query - A second query is however performed behind the scenes
[07:36:27] <Nodex> if at all possible you should avoid these types of queries and or adjust your data to use relationships as little as possible
[07:53:28] <Zelest> What is the idea behind the PHP driver connecting to all nodes listed in rs.status().members, even those listed as offline?
[07:53:58] <Zelest> It makes the whole point of the replicaset (apart from read-performance) pointless.. if one node dies and the application become useless. :(
[09:37:22] <phrearch> is there a common pattern i can use to prevent my nodejs app to crash on a socket hang up ? (seems like the mongodb connection is killed after a while)
[11:38:38] <Nilshar> Hello, I got 2 mongodb 2.2.0 clusters, on both, when I check rs.status() the primary says : "maintenanceMode" : -4 or on other cluster : "maintenanceMode" : -6 I didn't find anything to explain what is that "maintenanceMode" and the values in the doc. maybe someone can point me some doc about it ? (upgrade to 2.4 is planned, but will take a few time... :) )
[11:45:41] <coin3d> hello there. how should i model a many to many relationship within mongo, when the relation itself has an attribute?
[12:03:48] <kali> coin3d: make it so the most frequent request are the least expensive
[12:04:56] <coin3d> kali: this is in fact the same question that i have: http://stackoverflow.com/questions/4839881/how-to-organise-a-many-to-many-relationship-in-mongodb
[12:05:20] <coin3d> this guy has two tables, users and groups, and a relationship table with an extra attribute "isowner"
[12:05:29] <coin3d> would you put that attribute in one of the both collections?
[12:06:29] <kali> coin3d: you're thinking "static". you need to think "dynamic". you can't design for mongodb without having an idea of the querying patterns
[12:07:06] <kali> coin3d: if whenever you access a user you need to know its groups as well, then yes, it makes sense to embbed groups in user
[12:53:58] <danlamanna> hey guys - i have 2 collections (users and items), a user has an items field that is an array (reference based one to many) - i'm trying to figure out how to get a user document with the items embedded
[12:54:06] <danlamanna> does this involve mapreduce?
[12:54:24] <Nodex> please dont map/reduce in production LOL
[12:55:26] <danlamanna> huh? I just installed mongo for the first time on my local machine, just trying to figure it out
[12:56:05] <Nodex> well there is your first lesson :)
[12:57:20] <danlamanna> well how would i go about the one document with items embedded?
[12:57:36] <Nodex> re-model your data to not have it?
[12:58:41] <danlamanna> well i read the docs on referenced vs embedded - the idea is users could all have the same items, so i didn't want the same item data for every user that has it
[12:58:56] <danlamanna> so i figured an items collection and users having a field referencing item ids was best
[12:59:36] <Nodex> that's a "relational" way of doing things
[13:00:30] <patroy> Hi, I'm trying to setup replication on EC2 and I'm getting this error from the primary "failed: Temporary failure in name resolution".. I know this is an issue with amazon but when that happens, the secondary drops all the data that it had collected and starts over again. I'm just wondering if thats normal behaviour to prevent data corruption? thanks!
[13:00:32] <danlamanna> well i assumed since mongo supported relationships they were fine to a certain extent
[13:00:43] <kali> danlamanna: if you want to keep that design, you need to fetch the ids from the users, then do a queries on items with a _id : { $in: [...] }
[13:00:52] <Nodex> where does it say it supports relationships?
[13:02:14] <Nodex> that ^^ is a stupid tutorial and shouldn't be on the site
[13:02:42] <Nodex> I can onyl assume it's there to attract more RDMBS types
[13:02:54] <Nodex> + or to prove that things of this nature can be done
[13:03:44] <kali> Nodex: i thinks that's the spirit... it's topped by a reference to "Data modeling considerations", in the middle of a list of a dozen modeling partterns...
[13:04:18] <Nodex> but the RDBMS types will jjst try to follow this which is NOT a good idea
[13:04:34] <Nodex> perhaps it needs a label saying "If you really must live in a relational world then do this...."
[13:31:51] <danlamanna> kali: so the $in idea worked, but you agree with Nodex I should be modeling things differently?
[13:33:58] <kali> danlamanna: depends on your app. you need to consider your most frequent queries and model for them. if displaying a user with its list of items is frequent in your app, then yes, you probably need a refactor
[13:34:54] <coin3d> guys, another newbie question. if a blog document has embedded comments. now there should be a view, which displays just all the comments. is it possible to select only the embedded comments from all blog entries?
[13:35:29] <kali> coin3d: the aggregation framework will do it
[13:35:38] <danlamanna> kali: I would say the most frequent are displaying all items, and then displaying a user with its list of items
[13:35:49] <kali> coin3d: but it will obviously be more expensive than a lookup on a post by id
[13:36:21] <danlamanna> kali: the reason i decided to nosql was because "items" is a loose term, and there are any amount of types of items all with different attributes
[13:36:43] <danlamanna> kali: i actually asked #mysql about my last schema and the general consensus was to use a nosql solution
[13:44:59] <kali> danlamanna: well, why not, but be aware it's far from a drop-in replacement. you need to unlearn and relearn stuff
[14:01:21] <jribnik> i have a three shard cluster across which i built an index; the index appears once on two of the shards and twice on the third
[14:01:25] <jribnik> can anyone make sense of that?
[14:11:44] <Nilshar> Hello, I got 2 mongodb 2.2.0 clusters, on both, when I check rs.status() the primary says : "maintenanceMode" : -4 or on other cluster : "maintenanceMode" : -6 I didn't find anything to explain what is that "maintenanceMode" and the values in the doc. maybe someone can point me some doc about it ?
[14:13:56] <Nilshar> this thing just give NO result on google :/
[14:19:01] <Zardosht> What is the purpose of the "local.slaves" collection in replica sets? I know what it does, it saves the OpTime that slaves have synced to. Is it there just for diagnostic purposes, or does some piece of the internal system actually use it?
[14:20:52] <Derick> Nilshar: all I can find in the source is that they are not constant values - it's a counter of something I can't see what of
[14:21:59] <Zardosht> From my understanding of the source, maintenanceMode is a count of threads that have transitioned a secondary from the RS_SECONDARY state to RS_RECOVERING state
[14:22:26] <Zardosht> running the command "replSetMaintenance" with with true increments it, and running it with false decrements it
[14:22:30] <Nilshar> Derick Zardosht: hum... does not really make sense with negative values :/
[14:24:11] <Zardosht> In the function bool ReplSetImpl::setMaintenanceMode(const bool inc), I don't see any check that ensures the count is greater than 0 before decrementing it
[14:25:40] <Nilshar> will try a few things on test cluster then... but sadly I got this "issue" (it's not really one but...) on prod clusters..
[14:25:41] <Zardosht> so yea, to summarize, the command replSetMaintenance will increment when true, decrement when false, and if that command runs with false multiple times without having a corresponding run with true, I think the count can get negative.
[14:28:03] <Nilshar> Zardosht: thank you, make sens, so probably a bug, but should not be too bad... and will probably goes away on upgrade
[15:17:49] <ggherdov> Hi all. I am about to click "buy" for "mongodb applied design patterns" http://shop.oreilly.com/product/0636920027041.do given that's my first text on mongo, am I making a good choice?
[15:37:23] <progolferyo> I'm trying to profile a secondary in a sharded cluster and I'm trying to just log every request coming in for a brief period of time. does anyone have any idea why its not logging. I'm calling db.setProfilingLevel(2); and then looking here, db.system.profile.find().sort({$natural:-1}).pretty(); but its just not recording the queries coming in
[15:39:26] <stevie-bash> Where are the querys stored, if you are using mongos router and a client with Safe=false write concern set? Does the router cache this querys in the memory?
[19:45:01] <halfie> posts.find({"author": "Mike"}) <=== how do I get a list of all"author" values? will aggregation help?
[19:47:08] <kali> halfie: distinct for very simple needs on trivial setups, aggregation framework otherwise
[19:48:47] <halfie> kali, thanks! distinct works fine.
[20:47:14] <Altonymous> I am having a problem setting the ulimits for mongod I have updated my limits.conf file but when I use the bash file for return-limits mongos it stills returns the 1024 value instead of the new value I've set?
[20:49:51] <saml> takes mintutes for lock to be released on concurrent writes
[20:50:02] <saml> does mongodb have concurrent write/read problem?
[21:30:15] <oskie> Altonymous: I had the same problem. sometimes it worked for me, sometimes it didn't. I placed the rules in some file in /etc/security/limits.d and rebooted the system