[00:07:40] <Boomtime> brotatochip: then it sounds like the right configuration for the use case you want addressed
[00:10:54] <brotatochip> unfortunately I can't seem to get a working replica set period. No matter what kind of configuration I use, the initial sync fails
[00:36:21] <joannac> brotatochip: how large is the data you're syncing?
[00:36:37] <joannac> how heavy a write load do you have?
[00:37:12] <joannac> pastebin the whole section of logs so we can see the errors around it
[01:13:52] <brotatochip> joannac there is no load at all as I'm using a test environment, and the /var/lib/mongo dir in the primary is 3.6gb
[01:14:43] <brotatochip> here is a pastebin of my config and log, but the log is the same regardless of the config settings, and logs the same thing any time I try to add a secondary http://pastebin.com/p7T4zZ5F
[01:30:26] <joannac> brotatochip: ls -la <dbpath> on your primary
[02:39:12] <ctcg> Apparently you cannot modify multiple array elements in a single update operation, what would be the most efficient way to do so then?
[02:40:05] <ctcg> Here is some sample code i'm working with: http://pastebin.com/4y52YxCF
[02:40:29] <ctcg> I would like to be able to update all matching elements in an array in case there are duplicated skus
[04:44:35] <ev4l> Is it possible to expire a single filed of a schema at a certain date / time? I see it is possible to expire the netire schema
[07:31:02] <joannac> well, maybe. do you have journalling on?
[09:02:18] <jelle> what's the best way to use the pymongo with flask, for example now I create a mongodb connection every time a request comes in, but might it be more performant / better to just keep it open?
[10:26:24] <Naeblis> Hi. I upgraded to latest mongoose and am getting mongoose.mongo.BSONPure as undefined.
[13:29:37] <miwa> as I understand it, to provide document-level access control I need to implement Field Level Redaction (basically redacting the whole document I assume). How does this apply when using CRUD-methods rather than aggregate?
[13:59:03] <snuggles> is this still valid? http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/
[14:02:16] <StephenLynx> also mongo doesn't implement joins.
[14:02:31] <snuggles> i have products and customers, and these are stored separately, yet i need to related customers to products so i can figure out which customers have purchased a given product, and which products a given customer has purchased
[15:04:06] <eba> Boomtime it is written as The maximum size of a collection name is 128 characters, including the name of the database. However, for maximum flexibility, collections should have names less than 80 characters.
[15:04:07] <Boomtime> erk.. i think there are several things wrong with that statement
[15:06:26] <Boomtime> anyway, i'm pretty sure that FAQ is wrong.. or at least, something is wrong because these docs references appear to be in conflict
[16:21:06] <brotatochip> just an FYI, this documentation does not necessarily work: http://docs.mongodb.org/v2.6/tutorial/convert-standalone-to-replica-set/
[16:21:35] <__mph__> The unwinding and matching still returns documetns where the subdocument matches other cases :/
[16:21:49] <redsand> you'll only get the whole document
[16:22:01] <brotatochip> The only way to convert my standalone instance to a replica set that worked was to dump the db, wipe /var/lib/mongo, restart mongodb as a replica set, add the members, then mongorestore.
[16:22:10] <redsand> you can try pushing those elems that match into its own array maybe? with elemmatch and $push ?
[16:22:41] <brotatochip> so StephenLynx it's the documentation that's broken, not the feature
[16:22:42] <__mph__> redsand: I want the whole document.. I just don't want the documents that match other cases
[16:23:01] <__mph__> Basically, I'm looking for the case where the current person I'm looking at sent a message and it was never ever responded to
[16:36:42] <__mph__> Can I match on a case in the thread
[16:36:59] <__mph__> like $eq: 1, $nin: '$recipient_ids'
[16:43:10] <__mph__> can I match on a case based off of values in the document? (i.e. like $eq: 1, $nin: '$recipient_ids)
[16:54:03] <brotatochip> is anyone available to help explain to me the best way to set up a failover for disaster recovery? i tried following this guide http://docs.mongodb.org/v2.6/tutorial/deploy-geographically-distributed-replica-set/ but when both the primary and the arbiter become unreachable, the secondary does not elect itself a primary.
[16:54:54] <brotatochip> what worked was spinning the arbiter back up, however, that document recommends that you keep the arbiter in the same DC as the primary, so if SHTF in that main DC, there is no failover...
[16:57:35] <deathanchor> are you talking about hot failover, warm failover or cold recovery?
[16:58:27] <deathanchor> and are you also talking about machine failure, DC failure or nuclear winter failover?
[16:58:28] <brotatochip> any of the above deathanchor, none work when following that guide with a 3 member set - 1 primary, 1 secondary, and 1 arbiter
[16:59:25] <deathanchor> is your app (accessing the DB) in the same DC as primary or secondary?
[17:00:00] <brotatochip> i have redundant hardware in both sites, i will configure the DR environment to read/write from the secondary, spin them up in the event of a disaster
[17:00:25] <brotatochip> so like i said, cold, warm, or hot failover will all work
[17:00:26] <deathanchor> your app should know about the primary and all secondaries
[17:00:46] <deathanchor> voting works as majority of the known number of voters
[17:01:01] <brotatochip> no, my app shouldn't, as my main production app is on the east coast and my DR site is on the west coast
[17:01:13] <deathanchor> assuming primary secondary and arbiter has 1 vote, you need two to communicate so that you have quorum
[17:01:31] <jigax> is it possible to use $set with $push in one query?
[17:01:34] <brotatochip> ok, so should I disregard the guide and put my arbiter in the DR site?
[17:02:03] <deathanchor> no, because if it ever loses communication with your primary, your primary will stepDown
[17:03:37] <deathanchor> if the DC dies, we can just bring up a backup if needed
[17:04:05] <brotatochip> right, my boss has tasked me with setting up geographical redundancy, so I'm just trying to find the best way to keep the DBs in sync so we lose as few writes as possible
[17:04:26] <deathanchor> you don't want elections then switching your primary from region to region
[17:05:05] <brotatochip> well i tried master slave replication using a replica set, and I was unable to force the secondary to become primary
[17:05:38] <deathanchor> you have to think with quorum requirements for your scenarios
[17:06:08] <brotatochip> do you think I should try to use the legacy master/slave replication deathanchor ?
[17:06:14] <deathanchor> you can do secondary+arbiter in one DC, and primary in another. Then set priority to primary higher
[17:06:41] <brotatochip> yeah but like you said if the primary loses contact with the arbiter, won't it step down?
[17:06:50] <deathanchor> but know that any drop of network between DC will cause eletion and the secondary would take over
[17:07:23] <brotatochip> the secondary stepping up won't cause any headache, I can force it to step back down manually if needed, i just can't have the primary stepping down
[17:07:25] <deathanchor> that's what I like to call the "hot" failover
[17:07:58] <deathanchor> the primary will stepdown if there is a disconnect between DC
[17:08:10] <deathanchor> Like Highlander: there can be only one
[17:09:12] <unseensoul> What's the best way to retrieve the highest value from a column?
[17:09:22] <brotatochip> right, so do you know of any configuration that would give me any kind of failover while keeping 2 members in sync deathanchor, without the risk of the primary stepping down?
[17:09:45] <jigax> hi, anyone know if its possible to use $set and $push in the same query? i'm currently getting an error
[17:11:36] <Boomtime> @unseensoul: sort by the field you want, limit to 1 result
[17:12:03] <deathanchor> brotatochip: that's not how mongo works as far as I know
[17:12:11] <Boomtime> @jigax: yes, you can use $push and $set in the same *update* (i assume this is what you meant), but they must refer to different fields
[17:12:49] <jigax> @Boomtime im currently trying exactly that. but get an error
[17:13:12] <Boomtime> "an error", can you elaborate?
[17:13:27] <brotatochip> so looks like my only option is to try legacy master/slave replication, or have a 3 member set with 2 arbiters
[17:13:55] <deathanchor> brotatochip: you will always have 1 primary, you can't have 2 for one set.
[17:13:57] <Boomtime> @brotatochip: what are you trying to do? sorry, i missed the start
[17:15:20] <brotatochip> i'm just thinking maybe a 5 member set - 2 in the main DC with 1 arbiter, 1 in the DR site with the other arbiter - should prevent the primary from stepping down if my VPN goes down
[17:15:59] <brotatochip> And it also should cause a failover if the main DC goes down
[17:16:02] <Boomtime> brotatochip: the arbiters in that arrangement are redundant
[17:16:19] <brotatochip> Yes, but I still have an odd number of votes
[17:16:46] <deathanchor> brotatochip: it's not odd number it's majority that wins
[17:16:53] <Boomtime> if you have 5 members, where 2 are arbiters, and you remove the 2 arbiters, then you still have an odd number of votes
[17:16:53] <jigax> @Boomtime please check this jsbin http://jsbin.com/hepixoqazi/1/edit?html,css,js,output
[17:16:54] <jigax> @Boomtime if i comment out $set or $push the code works fine. but not with both
[17:16:56] <deathanchor> your failover won't win if 3 votes are missing from the first DC
[17:17:07] <brotatochip> yes Boomtime, I'm aware of that
[17:17:34] <brotatochip> so how the fuck do you configure mongodb replication for disaster recovery
[17:18:06] <brotatochip> I've spent nearly 3 days of work on this...
[17:18:23] <Boomtime> @jigax: and what is the _error_?
[17:18:50] <Boomtime> @brotatochip: if you have only 2 DCs then one of them is critical, it is logistically impossible to have a majority in both places
[17:19:21] <Boomtime> the usual recommendation is to have 2 data-bearing DCs, and one arbiter (light-weight) DC to break the tie
[17:19:23] <brotatochip> http://docs.mongodb.org/v2.6/tutorial/deploy-geographically-distributed-replica-set/ so what's the point of this then?
[17:20:05] <unseensoul> What's the best way to retrieve the highest value from a column?
[17:20:07] <jigax> @Boomtime error 500 and record is not updated
[17:20:18] <deathanchor> brotatochip: the second DC has a replicamember with priority:0 it will never win.
[17:20:37] <Boomtime> @brotatochip: you are conflating disaster recovery with availability - with 2 DCs you get data protection, but you might not have a primary, you might not have availability
[17:21:13] <brotatochip> right, so that document provides exactly zero DC fault tolerance
[17:21:28] <Boomtime> it provides distaster recovery, you lose no data
[17:21:46] <Boomtime> if you want to maintain availability in the face of any fault, then you need 3 DCs
[17:21:48] <brotatochip> how exactly does it provide disaster recovery if you can't elect a new primary?
[17:22:18] <Boomtime> you can recoer from a disaster
[17:22:18] <vinayus> hi i'm facing this error when i run mongodump on windows 8.1
[17:22:18] <jigax> @Boomtime also see undefined in the console but not sure what is undefine. because when i comment either line query works just fine
[17:23:30] <MacWinner> do object id's need to be globally unique? eg, user1 = { _id: 1, name: 'joe', bikes: [{_id: 1, type: 'mountain'}, {_id: 2, type: 'racing'}]} i'm migrating from mysql and some of my tables have same ids..
[17:23:38] <deathanchor> brotatochip: correct, but it breaks the replicaSet
[17:24:34] <brotatochip> like, could I just do another reconfigure and fix it? or do I need to rebuild the entire replica set deathanchor ?
[17:25:00] <deathanchor> let's use the setup on the webpage. if DC1 got nuked, you only have DC2, you make that member a single member replicaSet and spin up new machines to become secondaries.
[17:25:03] <Boomtime> @brotatochip: can you please explain what you think mongodb should do in the case of 2 DCs where either one is lost?
[17:25:28] <brotatochip> that is a separate issue outside my use case Boomtime
[17:28:05] <brotatochip> Boomtime I've explained my use case I think, but let me explain further - I have 2 DCs, one on the east coast, one on the west coast, the east coast DC hosts production with a standalone mongodb instance. I simply need any kind of failover so that if the east coast DC goes down, my DR site can take its place.
[17:28:17] <vinayus> yes i think.. but i dont know why thats happening in localhost..
[17:28:40] <vinayus> i'm new so not much experience with it..
[17:28:42] <deathanchor> hence my hot/warm/cold questions...
[17:29:09] <brotatochip> yes deathanchor, to which I replied any of them will work
[17:29:51] <brotatochip> hot would be great but not necessary, I can do a manual one
[17:31:26] <brotatochip> adding a 3rd DC increases failure points and reduces fault tolerance
[17:31:34] <Boomtime> @brotatochip: impossible with only 2 DCs, how can the DR site know that it isn't simply a connectivity problem? i.e that east coast is actually operationally fine
[17:32:04] <vinayus> @Boomtime any tips on how to fix that in win8.1?? Any network interface issue?
[17:32:24] <Boomtime> the only physically possible way the two sites can determine which one is actually at fault, is by having an arbiter break the tie and vote for the one it can see
[17:33:21] <brotatochip> Boomtime: what about a manual election to primary in the event of a DC failure?
[17:33:22] <Boomtime> if you host that arbiter in one of the 2 DCs, then that DC becomes critical, the other one can never determine the difference between a connectivity problem and a meteorite
[17:33:48] <Boomtime> there is no such thing as a manual election - do you mean a forced reconfig?
[17:34:11] <Boomtime> if you reconfigure the replica-set, then you have broken the symmentry - this can be done safely if you are batman
[17:34:51] <brotatochip> what if I have 2 arbiters - one in the prod site, one in the DR site, keep the DR arbiter offline until SHTF, spin it up, will it elect the secondary to become primary if it can't reach the primary?
[17:35:19] <Boomtime> you have 5 members, 3 in primary site, 2 on the other, same problem
[17:35:49] <Boomtime> it is mathematically impossible to divide a number by 2 and have more than a half in each of the two parts
[17:35:51] <brotatochip> no actually I'm thinking a 4 member set -1 primary, 1 secondary, 2 arbiters, but keep the second arbiter offline until I actually need it
[17:36:08] <Boomtime> no, it is either part of the set or it is not
[17:36:27] <Boomtime> if the other members know about it, they'll want it around, and expect it to vote
[17:36:39] <Boomtime> if the other members don't know about it then it's of no use
[17:36:44] <brotatochip> Well I have no other options here other than to test that theory
[17:36:53] <brotatochip> but they will know about it Boomtime
[17:36:55] <Boomtime> then you will need to reconfig
[17:37:15] <brotatochip> there will be 4 members in the set, one will just be offline until its vote is needed as the main DC goes down
[17:37:16] <Boomtime> again, it can be done, but it can be dangerous
[17:37:36] <Boomtime> if you have 4 members in the set, then you lose majority no matter which DC goes down
[17:37:47] <Boomtime> you will have no primary if you even have a connectivity problem
[17:37:48] <brotatochip> even if there are only 3 members online
[17:37:56] <Boomtime> there are 4 members in the ste
[17:43:58] <redsand> i have mongo showing up onsite monday to prove it
[17:44:11] <MeStesso> Hi! I’m looking at setting up a local (in-house) MongoDB instance to replicate the contents of the database on EC2, for backup purposes. Our budget is very limited so I can’t get VPN equipment… We’re also behind a firewall so we can’t accept connections from outside; however, we do have a static ip. I’ve been reading all the docs and I assume that I can’t do a replica set (with an hidden slave), but I can do master-slave
[17:44:12] <MeStesso> replication… is that correct?
[17:44:32] <brotatochip> ROFL MeStesso gl with that
[17:46:47] <Boomtime> @brotatochip: i want you to explain your understanding of the "primary" role
[17:46:51] <brotatochip> would the slave be able to become a master without it breaking anything
[17:46:59] <Boomtime> i think there is a misunderstanding here
[17:47:03] <MeStesso> so… about my question… can I do that or not?
[17:47:03] <cheeser> why would you use master/slave today?
[17:47:26] <brotatochip> cheeser should I copy paste my use case again?
[17:48:10] <cheeser> does it require master/slave? because there's almost 0 reason to use that today.
[17:48:25] <brotatochip> cheeser I have 2 DCs, one on the east coast, one on the west coast, the east coast DC hosts production with a standalone mongodb instance. I simply need any kind of failover so that if the east coast DC goes down, my DR site can take its place.
[17:50:20] <brotatochip> again, i've been through this discussion with Boomtime, the maths don't work
[17:50:31] <Boomtime> it is not possible, without a reconfig
[17:50:44] <cheeser> though Boomtime(?) is right that you'd need a 3rd location to ensure quorum voting
[17:50:45] <MeStesso> so can anyone answer my question. i don’t think it’s hard… do you think I can do what I’m planning to do? use master/slave for backing up, as I can’t use replSet because the office is behind a firewall?
[17:50:58] <brotatochip> which means in the event of a disaster, i'd have to do a forced reconfig
[17:51:06] <Boomtime> that is only to assure a primary - if all you want to maintain is read capability then you get that already
[17:51:12] <cheeser> MeStesso: don't use master/slave
[17:51:13] <deathanchor> MeStesso: set your slave to hidden it will never vote for itself
[17:51:36] <brotatochip> yeah unfortunately I need write capability too Boomtime :/
[17:51:48] <MeStesso> deathanchor: but I can’t use hidden slaves (replset) if I’m behind a firewall… because they can’t communicate with each other. correct?
[17:51:53] <Boomtime> then you have to have either 3 DCs, or learn how to do reconfigs safely
[17:52:09] <Boomtime> the 3rd DC can be very lightweight btw
[17:52:17] <Boomtime> you would get away with a micro in AWS
[17:52:18] <deathanchor> MeStesso: your sets need to beable to connect to each other
[17:52:22] <brotatochip> Boomtime if there are docs or guides or anything you could point me to to learn how to execute safe reconfigs, I'm all ears
[17:52:32] <MeStesso> deathanchor: that’s why i was thinking of master/save.
[17:54:16] <MeStesso> that’s why i’m asking about master/slave. it’s my understanding only the slave needs to connect to the master, but not vice versa. am i correct?
[17:54:33] <deathanchor> it is two way communication
[17:54:57] <deathanchor> how can the primary verify that the secondary says who it is?
[17:55:05] <brotatochip> MeStesso: you don't have any access to add a firewall rule?
[17:55:26] <MeStesso> brotatochip: if I had, i’d tell you :) I can control the firewall behind the master, but not behind the slave
[17:55:46] <brotatochip> damn, yeah, I don't think you can do anything there without a two way communication
[17:55:50] <MeStesso> brotatochip: we’re renting office space in a coworking place, so we share the network. that’s the best I can do
[17:56:20] <MeStesso> deathanchor: what does “verify that the secondary says who it is” mean?
[17:56:39] <MeStesso> brotatochip: need new networking equipment and ~$40/month for Amazon VPC. boss says no
[17:57:09] <brotatochip> Thanks Boomtime ! also thanks deathanchor and cheeser and Boomtime again for explaining these things to me. You've really helped my understanding of MongoDB and replication and now I at least know what my options are, however limited
[17:57:18] <Boomtime> @brotatochip: you should consider forced reconfigruation to be dynokryptonite to be used in anger only if you are covered in petrol near open flames
[17:57:49] <brotatochip> right, because how would I get all the new writes back to the original primary after the fact
[17:58:42] <cheeser> new writes would sync back to the now secondaries in the original DC. when that's done, you can step down the DR primary
[17:59:00] <Boomtime> and reconfig to remove the spare members you added to achieve that situation
[17:59:13] <Boomtime> *after* the original DC has caught up
[18:00:03] <Boomtime> btw, if the original DC comes back, you must kill it fast unless it can communicate with the restore DC - otherwise the original DC wil believe it can see a majority of the original members
[18:00:48] <Boomtime> this is the danger of force reconfig - you should test this, make sure you understand the permutations, understanding is key to making that situation work
[18:00:49] <brotatochip> it's actually ok if that happens Boomtime because then I can just rs.stepDown that primary as no traffic will be hitting it until I reconfigure route 53
[18:01:15] <brotatochip> oh you bet I'm going to test it lol
[18:01:47] <Boomtime> if the original DC votes in it's own primary, with you forcing another one to exist in the remote location, the replica-set will have diverged and cannot be reconciled easily
[18:03:03] <brotatochip> ok, the thing is, i think i'll just have to kill the VPN so that when the original primary comes back up, it will just pick up where it thinks it left off
[18:04:17] <cheeser> you could just go in to read only mode during the DC down time
[18:12:20] <svm_invictvs> Well, my lucene/gridfs storage driver seems to work like a charm
[18:12:20] <MacWinner> hi, I'm using the latest versions of mongo 3.0.3 and mongoose 4.0.4. I have a simple model method to save some usersettings. http://pastebin.com/hdvwYFnR Anyone know why this hangs when I call self.save() ? my OS shows 100% cpu usage and the save never seems to return. I'm using iojs + promises as well
[18:12:31] <svm_invictvs> After I finally figured out how Mongo seeks files.
[18:12:33] <MacWinner> it seems like I'm missing something simple
[18:13:04] <svm_invictvs> I have a silly question, is there a reason why the Java grid FS drivers can't just seek to any point in a file and open an input stream from there?
[18:13:12] <svm_invictvs> or...just seek the stream?
[18:21:29] <brotatochip> cheeser I can't go into read only mode during the downtime, mongodb is the back end of our social platform with over a million users
[18:21:49] <deathanchor> Boomtime: i do worse than force reconfig, I drop local dbs and set up new shardsets.
[18:27:58] <MacWinner> StephenLynx, do you use something else for ODM? particularly interested in simple hooks into update/save/delete as well as having custom methods
[18:28:00] <StephenLynx> brotatochip hm, using mongo for a social platform seems like a bad decision, if you ask me. but I know that is unrelated to your issue.
[18:31:29] <brotatochip> StephenLynx I've read the rant from the webapp programmer at Diaspora if that's what you are referring to, unless you have another reason that MongoDB is not a good backend for a social app
[18:35:39] <StephenLynx> I read that as soon as your data is larger than your RAM, it becomes really bad.
[18:36:06] <StephenLynx> I would personally just use a relational DB for that case and a cache for whatever needs a cache.
[18:36:14] <StephenLynx> maybe redis, maybe another tool.
[18:36:49] <brotatochip> I'm not sure if that's true in our case as mongodb data dir is 32gb, the machine has 30gb ram and there is 3.2gb ram free StephenLynx
[18:38:42] <StephenLynx> so you just need to know the id of the user that did what.
[18:39:00] <MacWinner> so if you have a document retreived from mongo, and you need custom methods like "sayHello()" or whatever other business logic you have, what's the best way to do this? I'm coming from mysql+php way of doing things, so I'm guessing I'm just htinking about it wrong with mongo+nodejs.
[18:39:01] <StephenLynx> of course the application in its current state is not engineered for a rdb
[18:39:20] <StephenLynx> what do you mean custom methods?
[18:39:39] <StephenLynx> have functions in the returned objects like they are instances of classes?
[18:40:38] <brotatochip> it's like a forum with topics, posts, comments, friends, chats, etc
[18:40:59] <StephenLynx> ok, nevermind. when you mean "social platform" I think more of facebook.
[18:41:21] <brotatochip> ah, yeah, it's not quite facebook, although we do have activity streams
[18:41:25] <MacWinner> so is the pattern to apply some sort of decorator to the returned objects from mongo? or set the prototype of the returned object to something with all yoru custom methods you need?
[18:41:52] <StephenLynx> I just have a function that uses the array of objects, MacWinner
[18:42:23] <StephenLynx> I want to save X? saveX(myX)
[19:56:52] <_ari> deathanchor: i'm outputing my aggregation and looping over the aggreagation to update
[19:56:58] <_ari> but it doesn't seem to be updating
[19:58:37] <_ari> what's a good method to group all elements in a document together and update
[20:39:18] <Iniglo> Hey guys, I'm trying to create a blog with Mongo as the database but it won't allow me to store blog post content in the database. I keep getting an ILLEGAL error because of the newlines inside the content entries. Anyone know how to work around that?
[20:39:36] <cheeser> doesn't sound like a mongo error.
[20:39:54] <cheeser> (having helped build a CMS on top of mongodb)
[20:40:24] <Iniglo> Yeah you're right I'm calling an insert using meteor, sorry that probably makes a huge difference lol
[20:40:59] <Iniglo> So it's a meteor issue not a mongo issue with the newlines?
[20:41:12] <Iniglo> I just figured it was database related, first time working with mongo
[20:43:06] <Iniglo> still getting the same error inside the mongo console
[20:45:44] <StephenLynx> I suggest not using frameworks or ODMs.
[20:46:12] <StephenLynx> unless you already already familiar with the base tools and know what kind of compromises you are making in using these additional tools.