[01:59:23] <aZnmAn> Hi guys -- new here. Wondering how to find() a nested document... http://pastebin.com/z9Zd9j6g for JSON. Need to find posts by an author (I'd like a nested setup for categories too)...
[02:02:18] <aZnmAn> db.listings.find({author: /Smith/}) for instance doesn't return anything
[05:37:18] <domo1> whats the difference between using mongo references vs referencing doc IDs manually?
[05:37:24] <domo1> should refs always be used now?
[06:04:50] <kreedy> anyone have a good first place to look for why mms only sees one secondary and no primary in my 3 box replicaset? when i added all 3 boxes with auth. there is also an agent running on each one
[06:04:58] <kreedy> i get type "no data" from two of them
[06:08:54] <jeremy-> Is there anyway to use update/upsert to NOT do the upsert (create an additional entry), of a second query is true. I can think of one way of doing it which is doing a .find() first, then just programatically not doing the upsert query if that is true. Anyway in one mongo request? I suppose its wanting an additional query parameter for upsert that i dont see.
[06:11:13] <jeremy-> my question was kind of vague so I'll give an example from my pymongo: self.collection.update({'date' : q}, { '$set' : {type : q, typestatus : 'ready'}}, True) IMAGINE THERE IS AN ADDITIONAL FLAG... DONT DO UPSERT/ANYTHING IF... typestatus : { '$nin' : ["csv", "complete"]} ..
[06:12:20] <jeremy-> I think this is just not possible so i guess i'll just use two queries
[06:26:22] <abhi9> is there any way to set matched item as a key from an array in mapreduce, except loop?
[08:22:44] <ranksu> hi, I believe I can possibly get some help from here regarding the mongo
[08:23:41] <ron> well, if you believe, it must be true!
[08:25:56] <ranksu> the thing is that I'm having a large collection of POI's in mongo. When I'm doing a bounding box query, I got the POI's only in center of the box. however I'd like to have them in newest first
[08:26:43] <ranksu> that's the problem since it doesn't seem to work. But stack is java with spring data
[08:27:11] <ranksu> whenever I specify the sort order in spring data the query will be god slow
[08:33:03] <kali> ranksu: have you checked what query spring sends to mongodb ?
[08:33:11] <kali> ranksu: and do you have the matching index ?
[08:34:34] <ranksu> I do have a matching index. the query _seems_ to run fine in console, but from spring it's slow. I've tried to debug the query, but I really cannot see the proper query that's been sent to mongo
[08:42:55] <ranksu> and the use case is rather trivial. "50 newest inside the bounding box"
[08:43:14] <kali> well, at least try to check out what spring does: you can probably bump the log level in your java app, or use mongosniff to sneak on the network, or use the mongodb profiler to get all queries
[08:47:20] <ranksu> I believe that's the route I have to take
[09:09:21] <NodeX> spatial queries wont even run without an index
[09:21:54] <waheedi> i just check my servers and saw oplog configured as oplog size: 9118.617382812501MB / log length start to end: 8378451secs (2327.35hrs)
[09:22:24] <waheedi> do you think i need to decrease that size and length ?
[09:23:17] <kali> i don't think there is any significant downside of having a big oplog
[09:23:31] <kali> except the disk space, but 10GB is nothing
[10:25:48] <Baribal> Hi. A friend of mine just tried to use a collections .copyTo (without having found API docs on it, btw), using a collection as parameter. The result was: "SyntaxError: missing exponent (shell):1". So... Does .copyTo() actually copy collections? And more importantly, what does copyTo do and where's the docs?
[10:27:30] <ron> chickamade: it's not a bad suggestion though. maybe you should open a feature request.
[10:58:06] <xcat> But I want to know what happens if you keep calling the function
[10:58:14] <xcat> My application would find it easier to just ensure the index exists than to try to determine if it exists first
[10:58:17] <NodeX> it will keep trying to add the index
[10:58:35] <xcat> In other words, it would be easier to blindly call ensureIndex than to try and introspect the collection to figure out whether the same index already exists
[11:01:33] <xcat> I want to do this with the TTL index; it won't have any adverse effect there either? Like restarting the background theread or anything weird
[11:01:41] <NodeX> what happens if you've got a massive collection that has no index and your app creates one...... it will hang your app
[11:02:42] <xcat> NodeX: not what we're talking about
[11:03:05] <xcat> TTL cleanup runs on a background thread
[11:03:39] <NodeX> xcat : it's exactly what you're talking about .. you asked about creating indexes over and over in your app, and i explained why it's a bad idea
[11:04:11] <xcat> That was 5 minutes ago, try to keep up
[12:03:12] <ABK> just can't take chances with Prod data right :(
[13:02:11] <lgbr> my reduce function only seems to be called on a very limited set of my database. So I might have hundreds of objects in a collection whose map key (first parameter of emit()) should have hundreds of entries in it, but when reduce is called, only ~70 or so items are in the second parameter of the reduce() function. Am I understanding map reduce wrong?
[13:24:30] <kali> lgbr: the reduce is only called is there is something to reduce: if you only have one value emitted for a given key, it will not need a reduce
[13:25:11] <kali> lgbr: also, consider using the aggregation framework instead of m/r if it can handle your task as it is much more efficient
[13:26:11] <lgbr> kali: My problem is that I have a key that should have >100 values, but it is consistently calling reduce with <80 values. They're not being broken up into different reduce calls or something are they?
[13:26:36] <kali> lgbr: ho yeah, that can happen too
[13:27:06] <kali> lgbr: if a key have 1000 emitted value, mongodb can choose to reduce the first half, then the second one, and the reduce again the two values
[13:28:47] <lgbr> kali: Hmm. The second parameter of my emit() function should have the same format as the return value of my reduce() function?
[13:36:49] <jonesy> I use Diamond to monitor mongodb, and it's creating metrics for, like, every mapreduce job. Where can I learn more about what's happening behind the scenes when I launch a mapreduce job, so I can better understand how to work with my monitor's data collector?
[15:52:56] <rickibalboa> Can anyone help me out with an issue. I have a query which I can run directly on the database https://gist.github.com/4548097 and it returns results which is fine, the next query is exactly the same, just PHP-ified, I run that in my PHP code and I don't get any results, database is definitely connected etc. Any ideas?
[16:00:42] <rickibalboa> It's returning about 30 results, narrowed it down to the timestamp part
[16:36:02] <owen1> what triggers an election for a new primary? only loss of connection to a member or are there more conditions like high cpu/memory/diskspace?
[17:16:01] <WarheadsSE> You've never seen server grade ARm equipment have you
[17:16:13] <NodeX> sarcasm doesn't generaly get people helped any faster ;)
[17:17:10] <WarheadsSE> True, but assuming I'm here beacuse I want my Android phone to run a nodejs webchat server with mongodb does't help in understanding the problem in any way either.
[17:47:20] <NodeX> (if you're trying to avoid network failure that is )
[17:49:06] <evan_> I'm doing some very detailed reporting on 100million events and was looking to use map-reduce. Should I use cassandra or mongodb or what?
[17:49:56] <NodeX> better o use aggregation framework
[17:54:01] <evan_> NodeX: Which one do you recommend ?
[19:03:09] <strnadj> You need ODD number of voters, because if you have even number of votes, there can be a situation - no one of nodes has most votes - 4 = can 2:2, 6 = can be 3:3 etc.. if you have ODD number of voters - this situation is not possible 7 - can be 3:4 etc...
[19:05:07] <JaredMiller> what if you have 5 nodes.. and one dies?
[19:05:41] <owen1> JaredMiller: if it's the secondary, nothing happens. if it's the primary, a new primary will be elected
[19:06:00] <JaredMiller> right, wouldn't there be 4 votes?
[19:06:12] <JaredMiller> so potential for a 2:2 split
[19:06:14] <kali> 4 votes out of 5 is a strict majority
[19:06:16] <owen1> based on which primary has the recent oplog
[19:06:59] <owen1> in 5 nodes, 2 primary can die and the rest can still vote
[19:07:30] <owen1> in 3 nodes only 1 primary can die
[19:08:31] <owen1> the same for 4 nodes. that's why it's make no sense to use even number!
[19:08:58] <kali> the problem is not tie during the votes process. the problem is to make sure there is only one election taking place at a given time. so for an election to occur, you need a strict majority of nodes to be able to talk to each other
[19:23:19] <tworkin> in pymongo, there is collection.find().count(), but why isnt there len(collection.find()) ?
[19:26:37] <owen1> i have 3 nodes. 2 are dead. how to turn the survivor into primary?
[19:53:39] <owen1> i had 1 primary that survive out of 3. i did some config change to one of the secondaries (added himself and the other secondary to the conf) and reconfigure it. it seems like the survivour primary is not aware of the 2 nodes that came back to life.
[19:54:10] <owen1> do i need to run the reconfigure on the primary as well?
[19:55:00] <owen1> i thought the configuration file will be shared whenever i change it on any host.
[20:00:38] <owen1> also the rs.conf is the old configuration. the 2 secondaries have the new conf
[20:03:00] <owen1> maybe i should delete the data in the secondaries before changing their config?
[20:35:51] <WarheadsSE> kali: NodeX would either of you know who might be able to lend a hand in sorting out the issues seen by my users hwne building mongodb?
[20:37:39] <kali> WarheadsSE: you need help from the actual developpers... most of the people are are users, and most of discussion here is about usage
[20:37:58] <kali> WarheadsSE: you could try to open a jira, on contact 10gen for some consulting
[21:17:19] <andrewwinterman> do you guys know when you'd want to use multiple databases rather than multiple collections?
[23:02:26] <owen1> let's say i have 3 nodes (primary is here too) on west coast and 2 on the east. if the connection between the coast is lost, what ensures that i don't end up with 2 primaries? is it because of the fact that the east coast is not a majority?
[23:10:06] <owen1> another question - is there a need to restart my node client after reconfiguring a replica set (let's say new primary is elected, etc)?
[23:12:39] <linsys> owen1: What client are you running? I think node.js might have a bug if auth is enabled but besides that no to your restarting of the app node question.
[23:13:29] <linsys> owen1: for a member to become master it must have majority votes. If the west coast went down, 2 nodes is less the majority so no nodes on the east would ever become master
[23:14:28] <owen1> linsys: i use the 10gen official client. not sure if auth is enabled. what does enabling it gives me?
[23:14:54] <linsys> owne1: Well there are 10gen clients for many things.. what programing language is your app in?
[23:18:32] <linsys> vs now where you can just do like mongodb --host <ip> and look at all the dbs and such
[23:20:34] <owen1> linsys: regarding the other question, what if i have 1 host(primary) and the west and 2 secondaries on the east and there is a network issue between east and west. the 2 secondaries might think that the west is down so they will elect a primary and i'll have 2 primaries.
[23:23:06] <linsys> No, if that where to happen if there is a network issue the primary in the west will demote itself since it lost the majority of the vote thinking it's isolated
[23:26:41] <owen1> so if the primary is among minority, it will demote itself? let's say i have 2 nodes(1 of them is primary) in the west and 3 nodes in the east, and there is a network issue, the primary will demote itself as well?