[00:29:06] <Synt4x`> back for a question, if my id: {name, score, date} , and then I do $first : 'OtherOption' , it will grab the first OtherOption per unique {name, score, date} pair correct?
[00:29:12] <Synt4x`> (it's a question on how $first works)
[00:40:46] <diegoaguilar> I have a question about auth setting up, I followed this tutorial straight forward http://docs.mongodb.org/manual/tutorial/enable-authentication-without-bypass/
[00:40:53] <Boomtime> the first that "it comes across" is exactly right, unless you have previously specifically a sort order (in a previous aggregation stage for example) you won't know which document happens to be first
[00:44:27] <diegoaguilar> if I want to add any user I have to auth as that user and then create a new user for a certain database with the proper roles
[00:54:03] <diegoaguilar> when trying to switch to other DB and show collections it'll fail was I have no permission, but it's the userAdminAnyDatabase user!
[00:54:15] <joannac> right, you don't have any permissions
[00:54:15] <mango_> @joannac thanks just discovering now
[00:54:27] <joannac> userAdminAnyDatabase lets you create users in any database
[00:54:50] <joannac> it does not inherently give you privileges to read/write, however you can make yourself a user with whatever privileges you want
[00:54:57] <diegoaguilar> so root is the one which can do anything, read, update, etc?
[00:58:31] <joannac> use admin; db.system.users.find(...)
[01:07:58] <skaag> is there a .config thing to set the default mongo port for when I run the mongo shell?
[01:08:18] <skaag> since I am not using the default
[01:11:16] <Boomtime> that is an interesting question.. the shell has some startup scripts but i'm not sure if you can change the default port via that mechanism - what OS are you using?
[02:26:07] <locojay> interesting does that value not get updated?
[02:26:26] <Boomtime> it basically only goes up, unless you actively do something to reclaim disk space
[02:26:56] <Boomtime> it is telling you the disk space usage, and it's only a guess anyway - you should use db.stats() to get some accurate stats
[02:27:25] <locojay> been doing manually a fs.files.findOne({"_id":someval}) where someval is files_id of fs.chunks and found some orphan. are these really orphans? can i just delete them?
[02:27:58] <Boomtime> dunno, how do you know they are orphan?
[02:28:43] <locojay> assuming that files_id in fs.chunk is same as _id in fs.files
[02:28:55] <locojay> if not then i will leave as is
[02:30:26] <Boomtime> check in that to see if what you think is true - gridfs is just a wrapper to those collections so manipulating them manually is doable, just not advisable
[03:08:17] <morenoh149> it's called consistent hashing http://www.allthingsdistributed.com/files/amazon-dynamo-sosp2007.pdf
[05:13:53] <eric_lagergren> Okay, I'm stuck again. I'm using Mongoengine to query my database. But right now if I use `MyDoc.objects.get(state='WA')` I get an error nothing was found, even though every entry in my db has a "state" property, and half are "WA"
[05:14:18] <eric_lagergren> doesn't even matter if I use "id='...'"
[05:15:20] <eric_lagergren> Where would I start debugging this? I can't find any results, even though I easily insert data earlier and I see the data using the CLI application.
[05:17:57] <joannac> does it work through the shell?
[05:18:37] <eric_lagergren> joannac: yeah, I can run `db.collection.find({state:'WA'});` and it gets results.
[05:18:59] <joannac> you sure you're in the right database and/or collection?
[05:19:56] <eric_lagergren> I'm writing a portion of a larger codebase -- how would I double check this?
[05:20:14] <eric_lagergren> I'm calling some methods from a class that's `class Office(Document):`
[05:20:20] <joannac> i dunno. diagnostic printing?
[05:20:29] <joannac> I can't debug your application for you...
[05:20:46] <eric_lagergren> joannac: I know. I'm trying to figure out how.
[05:21:38] <eric_lagergren> I was also wondering if there were any constraints on objects.get(). I couldn't find any in mongoengine's docs, so I'm assuming there isn't
[05:21:49] <eric_lagergren> constraints as in only being able to search for certain things, etc.
[05:21:56] <joannac> not sure, not familiar with mongoengine
[07:37:46] <dbousamra> hi all. Can someone help clarify some questions on findAndUpdate for me?
[07:40:20] <Boomtime> dbousamra: ask and someone may be able to
[07:43:48] <dbousamra> I have Events. They have snapshots inside of them. I want to add a snapshot to the correct event based on whether that event was no longer than 5 mins ago, and the events last snapshot was less than 1 min ago. Otherwise, I want to create a NEW event. Here is my query: https://gist.github.com/dbousamra/85f2053fab77f3eb1cee
[07:44:00] <dbousamra> Is findAndUpdate going to update atomically for me in that scenario?
[07:48:47] <Boomtime> dbousamra: the action of findAndModify is always atomic, however, there are multiple ways your command can complete successfully without ever breaking the atomicity
[07:49:29] <dbousamra> Could you give me some more info/reading material Boomtime
[07:53:28] <Boomtime> how many documents can the find conditions possibly match?
[07:57:21] <Boomtime> it is important that the result of the update still matches the find conditions, if not then the same findAndModify command racing from a concurrent thread would invoke the upsert path instead
[08:10:29] <foofoobar> Hi. I’m using mongodb with php. I can insert to collection „foobar“ with php without any problem. Now I have this command: $ret = $collection->update($crit, $structure, array('upset' => true, 'w' => true));
[08:10:56] <foofoobar> $crit does not match because the collection does not exist yet, $structure is just some data
[08:11:13] <foofoobar> the $ret tells me ok => 1, but the collection is still empty
[08:11:18] <foofoobar> What can be the cause of this ?
[10:20:36] <arussel> what metrics should I follow to monitor the health of my db ?
[10:25:50] <joannac> arussel: have you considered MMS?
[10:28:24] <arussel> joannac: we already got solid cloudformation script, db running in production without problem, tested backup scrit, not sure I want to move all this somewhere else
[10:35:10] <joannac> i would say memory usage, cpu, disk usage, opcounters, lock%, queues, bgflush, replication stats
[11:22:48] <ssarah> hei guys, basic question i think. So i load a document into a var x, i alter some of x fields, and now would like to update the collection with my altered version of the document.
[12:26:51] <ssarah> ty Derick :) like this too? db.products.find( {},{ "limits.voice.units":1} )
[12:29:30] <Derick> ssarah: that whould work too, yes
[13:45:22] <ssarah> hmmm, db.products.update( { for: "ac3" } , { $inc: { "price": 3 } } ) only increases the price of the first object, why is this? (for is an index)
[15:05:32] <hydrajump> I have 3 members in a replica set. Looking at this link http://docs.mongodb.org/v2.4/tutorial/backup-with-filesystem-snapshots/ if I want to make backups do I run `db.fsyncLock();` on one of the secondary members?
[15:06:10] <hydrajump> or do I need to add a forth member that is "hidden"?
[15:06:36] <tscanausa1> saml: i am trying to find definitive proof but show dbs, I think show the on disk size not the actual size
[15:07:00] <saml> yah still, why use different disk size?
[15:10:40] <tscanausa1> when an object is deleted is does not free the disk space
[15:11:55] <tscanausa1> and objects are not put in the same spot on disk with 2 different servers. think if it like disk fragmentation
[15:26:01] <hydrajump> so it looks like I need to add a 4th member to the replicaset that is "hidden" and "priority=0" and use this one for backups, e.g. mongo shell `db.fsyncLock();`, make EBS snapshot, `db.fsyncUnLock();`. Can someone please confirm if this is the way to do it?
[15:29:36] <hydrajump> the following in the docs is not clear to me "Hidden members do vote in replica set elections. If you stop a hidden member, ensure that the set has an active majority or the primary will step down.
[15:29:38] <hydrajump> For the purposes of backups, you can avoid stopping a hidden member with the db.fsyncLock() and db.fsyncUnlock() operations to flush all writes and lock the mongod instance for the duration of the backup operation.
[15:30:54] <hydrajump> so if the 4th member is hidden and p=0 than it can still vote which is an issue with an even number of members, right?
[15:31:14] <minioak> Hi - question about HA clusters. What is the typical reason why you wouldn't want a member in a secondary data center to become a primary?
[15:46:36] <tscanausa1> because you would prefer a member in the same datacenter to take over.
[17:20:41] <culthero> I have a sharded collection across 4 shards that has a TTL index, but the TTL index is not expiring data. Any suggestions as to why this would happen?
[17:21:08] <culthero> I verified the indexes exist by going db.collection.getIndexes();
[17:21:15] <culthero> it is on a date field, and the TTL value is set
[17:21:30] <culthero> on an individual shard + on mongos
[17:55:38] <edrocks> is it better to store arrays on a user document then to just store the items in their own collection? They would never outgrow the user document btw
[18:20:56] <hydrajump> in a 3 member replicaset. Do I need a 4th "hidden, p=0" member to execute db.fsyncLock() for EBS snapshots?
[19:42:04] <desmondmorris> Is it possible to pull specifc versions of a document using its version key (__v)?
[19:44:23] <hydrajump> when you run db.fsyncLock() on a replicaset member does that mean that the PRIMARY is not able to receive reads/writes or is it the SECONDARY that won't replicate during the Lock?
[21:45:08] <James1x0> Anyone want to take a stab at a mongoose population issue? https://stackoverflow.com/questions/26370673/mongoose-population-myproperty-mymodel
[21:52:55] <zacaj> using nodejs and the regular mongo driver, is there any way to query for a single document and just get back that document that doesn't involve callbacks
[21:54:15] <zacaj> it's really annoying having to do a giant db.collection('name',{options},function(err,collection){collection.find({query},function(err,item){look I've got the item})})}); and indent all my code even further every time I want to look up a single thing
[21:56:27] <Boomtime> have you considered using a different language? because what you describe is just Node.js
[21:56:45] <Boomtime> note too that you can keep the "collection" object
[21:56:52] <hydrajump> Is it possible to do continuous backups of mongodb?
[22:00:29] <hydrajump> Boomtime: "MMS continually backs up MongoDB replica sets and sharded clusters by reading the oplog data from your MongoDB deployment.
[22:01:01] <hydrajump> I wonder if this is the same as running 'mongodump --oplog'
[22:01:05] <cheeser> hydrajump: yes. that's what i said.
[22:03:27] <hydrajump> cheeser: ok. I'm just trying to understand how it is done. Can't use MMS because of compliance so have to do it ourselves
[22:09:17] <cheeser> ah. on prem would probably work
[22:10:26] <hydrajump> sure. I'm interested in doing it without purchasing the enterprise subscription for now. Whatever the MMS backup agent is doing must be possible with the mongo tools or?
[22:11:45] <Boomtime> you might be underestimating your task
[22:13:12] <hydrajump> so it's not possible is what you're saying?
[22:13:26] <Boomtime> it's obviously possible, MMS Backup does it
[22:13:53] <cheeser> "it's just software. anything's possible."
[22:15:39] <hydrajump> ok so let me ask a different question if I'm not trying to replicate MMS backup.
[22:15:57] <Boomtime> what are your actual requirements for backup?
[22:16:47] <Boomtime> do you really need point-in-time restore or is that just a dream you have? for example, are 24 hourly backups sufficient?
[22:17:38] <hydrajump> I have many dreams one of which is to lose the minimum amount of data in a catastrophe ;)
[22:18:21] <hydrajump> I've been reading the docs on backups/restore and it's not entirely clear to me what impact there is on a 3 member replicaset when db.fsyncLock(); id run.
[22:18:50] <Boomtime> that command only runs on one member
[22:19:13] <Boomtime> in short, it prevents the member from writing to the hard-disk
[22:20:08] <hydrajump> Boomtime: so if I run that on a SECONDARY that member won't replicate during the lock, but the PRIMARY will still be able to receive reads/writes and the 2nd SECONDARY will replicate?
[22:20:52] <hydrajump> and mongodump effects a whole replicaset or it works in the same way but without requiring locking?
[22:21:19] <Boomtime> no, that's quite a different concept
[22:22:00] <Boomtime> mongodump is basically a client that connects to a database and extracts everything that you ask for
[22:22:25] <Boomtime> "effects a whole replicaset" <- this part makes no sense
[22:22:59] <Boomtime> mongodump requires no locking because it's just a client, but equally it does not produce a point-in-time
[22:23:28] <joannac> unless you run it with --oplog
[22:24:30] <hydrajump> Boomtime: ok so when it connects to a database member in a replicaset, any reads/writes to the PRIMARY and replication are not effected by the dump, they will continue it's just that they won't be part of the dump unless --oplog specified?
[22:25:59] <Terabyte> hey, suppose mongodb goes down, and comes back up again, is there anyway to get the clients to retry connecting? using java (spring)
[22:26:19] <hydrajump> ok and I assume that mongodump as it connects as a client impacts performance versus looking a SECONDARY and doing a snapshot. That's why snaphsots are preferred?
[22:26:43] <joannac> Terabyte: should be a connection option
[22:26:52] <joannac> Terabyte: something like autoreconnect=true
[22:27:08] <Terabyte> joannac setAutoConnectRetry is deprecated and "there is no replacement"
[22:28:36] <Terabyte> "There is no replacement for this method. Use the connectTimeout property to control connection timeout." not clear on how connectTimeout should be used to be equivalent to autoConnectRetry..
[23:07:58] <hydrajump> before running db.fsyncLock() on a SECONDARY should there be a check to see that that SECONDARY has replicated all the data from the PRIMARY or that implied?
[23:09:10] <Boomtime> hydrajump: i would certainly recommend checking that the secondary you intend to copy from is not too far behind
[23:10:19] <Boomtime> heath: paste the code line that gives you that error please
[23:16:32] <hydrajump> Boomtime: is rs.status() and comparing the optime between the PRIMARY and SECONDARY the way to do this or is there a quicker way?
[23:35:30] <Boomtime> the reason is because the oplog timestampts record the last operation seen
[23:36:26] <Boomtime> if you happen to query right after the primary accepts a write (after many minutes of nothing) then the secondary might appear to be lagging behind a long way (even though it is only behind by 1 write)
[23:39:39] <hydrajump> Boomtime: ok I understand. I'm looking in the docs now for how to script this from another server.
[23:40:39] <hydrajump> Boomtime: regarding verification. If I do hourly snapshots would running verification once a day, e.g. running db.collection.validate(true)
[23:41:57] <hydrajump> on the last days snapshot ok or would I need to run it hourly? I don't know if that's the only way to be truly confident that the snapshots are ok.
[23:45:39] <Boomtime> hydrajump: ultimately, running validate(true) is the most assured way of knowing that a snapshot is fully functional - it walks the entire dataset - unless you do this you can't know for absolute certain
[23:47:23] <Boomtime> with that said, obviously you may decide that your confidence levels will be high enough by checking every Nth backup rather than every single one
[23:48:32] <hydrajump> Boomtime: yeah but if I only verify the Nth backup and I need to restore maybe the N-1th than I won't know if that one is fully functional until I try.
[23:49:58] <hydrajump> so you've pretty much answered that verifying each hourly backup is the only way.
[23:54:10] <Boomtime> hydrajump: correct, if you need guaranteed 0% risk then you should check every backup
[23:54:48] <hydrajump> Boomtime: thanks for being so helpful!!