[00:14:14] <cheddar> Hi guys, question about node-mongodb-native and connection pooling. I believe I've read most of the docs for it, but I still have no clue if it handles connection pooling for me behind the scenes and I should call MongoClient.connect() every time I want a connection (i.e. node-mongodb-native will sometimes give me a pooled, cached, connection and sometimes open a new one) or if it's safe to store a reference to the db and collection
[00:14:15] <cheddar> objects returned from the callbacks and those will handle pooling, or if I need to do pooling manually?
[00:54:52] <NaN> is there any "last" method to get the last doc in a collection?
[03:08:31] <hunterp> I removed the embeds_one, embedded_in and it actually saves
[03:11:17] <hunterp> here is another way to look at it: http://stackoverflow.com/questions/21842535/embedded-object-saves-without-error-but-does-not-show-in-mongo-how-can-this-be
[03:19:32] <oblio> so i recently started getting db corruption problems regularly, "bad file number value" and "repair DB"
[03:19:37] <oblio> and i'm trying to track it down
[03:19:43] <oblio> it's started to happen almost daily
[08:12:10] <_Manu_> Hey all! I have two questions about MongoDB. 1) What is the consequence of creating a cluster composed of machines with wildly varying specifications (cpu, diskspace, disk speed, amount and speed of memory, network speed) and (2) can the cluster detect and compensate for such differences automatically?
[08:32:12] <Soothsayer> Is the aggregation framework meant to be used for frontend (user-facing) queries?
[08:32:21] <Soothsayer> Like say filtering products on a catalog page.
[08:51:07] <Nodex> Soothsayer : it can be but much better to use somehting that's meant for that kind of thing
[12:57:02] <scruz> hello. could anyone recommend strategies for multitenancy using mongodb?
[13:35:49] <cheeser> scruz: use a different db per tenant
[13:35:58] <cheeser> or flag every entity with a tenant id
[13:36:10] <scruz> cheeser: trying the first one with mongoengine.
[16:14:51] <blizzow> I have three mongodbs running as hidden members of a replica set on the same ec2 instance. I fired up the DBs to let them sync up 300
[16:17:42] <blizzow> in fact, it claims <20% most of the time.
[16:17:54] <blizzow> memory usage is pretty low too.
[16:18:33] <blizzow> Anyone have an idea of how I can get this hidden member in sync?
[17:02:39] <Number6> blizzow: What does "iotop -xtm 1" show for %util? Ignore the first set of values
[17:04:38] <blizzow> Number6: x and m are not options for my copy of iotop.
[17:05:35] <Number6> Ahh. Is there a way to see the %util, in your version of iotop?
[17:06:05] <blizzow> I restarted my mongodbs and the reads went way down(which is good). about 3M/s. Unfortunately, my dbs are not catching up and one seems to be stuck in STARTUP2 state
[17:06:23] <Number6> startup2 usually means init sync
[17:35:39] <sereal> Is there a way I can do distinct and return the first document from each distinct item? (I have a bunch of items with keys that match many other items that are related, each one has a time value and I would like to grab the document with the lowest time value. Doing distinct for all the keys then doing a for loop to do findOne of each key seems wrong to me.
[17:37:30] <Joeskyyy> Why not sort by the lower time value and do a .limit(1)
[17:38:07] <Joeskyyy> Unless I'm misunderstanding your query
[17:42:12] <sereal> well doing distinct only gives me the values that are distinct not the whole document. I want the whole document (which there are many of so i'll take the first one)
[17:42:48] <sereal> so I can do find distinct, then loop through each value and do a find on them then sort by time limit 1. but I feel like there should be a way to do this in one line no?
[17:44:32] <kali> sereal: look at the aggregation query with a $groupby using the $first aggregator
[17:44:46] <cheeser> that's what it was sound like to me, too.
[17:45:17] <sereal> I was looking at the aggregation query but I couldn't find a 'distinct' operator. or am I missing something?
[17:48:11] <Joeskyyy> Why do you need a distinct however, if you want the whole document in the end?
[17:48:45] <Joeskyyy> That's where I'm confused D:
[17:48:48] <sereal> because there will be many documents with the same value.
[17:49:09] <sereal> I could be inserting my data in the db wrong which is part of the problem
[17:51:58] <Joeskyyy> er… sorry sereal I guess I'm a bit lost still. Maybe it's the lack of caffeine.
[17:52:01] <sereal> I basically have { sandwichname: bla, ingredient: cheese, step: 1} {sandwichname: bla, ingredient: tomato, step 2} ... then there is like {sandwichname: bla2... etc. I want to find all the sandwiches, and only show me the document with the first step.
[17:52:03] <Joeskyyy> Can you give us an example of a few documents?
[17:52:44] <Joeskyyy> ^ post it in a pastebin or something please
[18:00:01] <Joeskyyy> At least that's how I'd prefer to handle it from an application perspective.
[18:00:06] <Joeskyyy> There's probably 3487398 different ways to go about it.
[18:00:25] <Joeskyyy> But in this case you don't have say, 10 docs, for each step of "bigGuy"
[18:01:13] <Siraris> I have a big problem. My mongo instance was writing to the wrong drive, and that drive now is out of space and mongo won't start. I can't even start mongo to export the data and use a different dbpath. Does anyone have any suggestions?
[18:01:29] <Siraris> Is there a way to start mongo using a different data path and then just import the data from the old data files?
[18:01:38] <sereal> It's probably better over all to do things this way. It started out as "oh I got this python dict... ima just dump it into mongodb!"
[18:01:55] <sereal> and now i'm wasting more time than if I had just did things the right way
[18:02:37] <cheeser> schemaless doesn't mean you don't have to think things through. :)
[18:02:43] <cheeser> we had that problem at my last gig.
[18:02:49] <Joeskyyy> +1, it's the number one mistake with mongo i'd say
[18:02:55] <Joeskyyy> "Hey, schemaless, dump ALL the things"
[18:04:18] <sereal> In this case it's not the end of the world, I don't have that much data. Migrating it won't be too awful. I'm sorta in a learning(more so fighting) nodejs and learning mongo
[18:06:54] <sereal> thanks for the help guys. It's a refreshing delight to go on irc and actually get helpful responses :)
[18:07:13] <cheeser> Siraris: just copy the data files to the new place, reconfigure mongod.conf, restart
[18:07:28] <Siraris> cheeser: I can just copy the .0 and .1 files?
[18:09:58] <cheeser> i believe so, yes. backup first, of course.
[18:23:16] <Joeskyyy> Who needs backups, I YOLO mongo all day.
[19:39:15] <tongcx> hi guys, i have the following task
[19:39:25] <tongcx> there is a field that's a dict
[19:39:33] <tongcx> and i want for each entry of the dict
[19:39:58] <tongcx> to remove one field from each entry of the dict
[19:40:07] <tongcx> what's a good way to do so in mongo?
[19:48:35] <scruz> tongcx: i imagine you're using python, and i'd imagine it'd be easier to do it in python.
[20:55:49] <cheddar> How does connection caching/pooling work with node-mongodb-native? I've read the docs, but haven't found anything about it. Am I just blind?
[21:13:36] <Nrdqvst> Hi guys, I am new to mongodb, just wanted to ask someone with a bit of experience a quick question, if anyone is available to assist?
[21:14:15] <Derick> Nrdqvst: IRC is asynchronous. Just ask, and if people know the answer they will give it
[21:15:47] <cheddar> Derick, does that mean that you do not know the answer to how connection caching/pooling is handled in node-mongodb-native? (my question from above) ;). I see you have op status, so figure you might actually be employed by Mongo ;)
[21:17:56] <Nrdqvst> I have created a user model, which forms part of the collection called "users" - the user model contains sensitive data, such as the email address of the user. When I call the users collection in my Backbone.js frontend, all the user models are loaded into the frontend, exposing the email address of every user - is there a way to keep the sensitive data as part of the user model? or should I
[21:17:56] <Nrdqvst> make another user model to keep all the sensitive data in?
[21:19:26] <Nrdqvst> to clarify the first part of the question: is there a way to retain sensitive information in the user model, but just not bring it out to the front end or hide it before it reaches the frontend?
[23:06:23] <travisgriggs> is there a more idiomatic way to write this pymongo expression? allNames = [{'id': str(doc['_id']), 'name': doc['name']} for doc in client.programs[treeId].find(fields=['_id, 'name'])]
[23:07:17] <travisgriggs> basically, i'm returning 2 field docs associating oid's with names, but stringifyng the oid in the process as well
[23:40:00] <sheki> what kind of a request does a getLastError send