[03:44:18] <shkx> Hey guys, ive run int oan issue where I need to import a bunch of data from one cluster (lets say in our prod environment) to another (lets say dev).. There maybe some duplicate data like primary keys and etc. I had alook at the syntax for mongorestore and it states that if there is a duplicate record, it will skip that and continue, and will only perform an INSERT operation, not UPDATE. I also noticed you can use the
[03:44:48] <shkx> my question is if you are using just mongorestore so that it will skip the duplicate info, does it inform you which data was skipped?
[03:45:28] <shkx> im writing a python script atm to parse the BSON data and check for any duplicate data but its probably just going to take a while to do that and id prefer it greatly if there is a way within Mongo to check for duplicate data
[04:05:52] <joannac> shkx: I don't think so, unless you check the logs
[04:31:40] <movedx> Hey guys. How can I go about filling a MongoDB installation with some example data? I need to do this from the CLI, without having to go into a shell. I'm doing this from Ansible.
[04:31:54] <movedx> I can write and push a shell script, etc.
[04:33:58] <joannac> movedx: erm, I don't understand the question. write a js script that loads data and use --eval?
[04:34:32] <movedx> joannac: Sure, I guess that works. I could write something in Python too... OK, I'll do that. Sorry for wasting your time - I should have given it more thought.
[10:42:00] <yopp> after 2.4 -> 3.0 updgrade some mapreduces are failed, because there a migration lock on sharded collection
[14:03:47] <atomicb0mb> hello ! Is there any document where I can read about the difference between upsert, update, and save?
[14:17:09] <sabrehagen> how can i monitor to see if mongodb is paging to disk?
[14:37:02] <danijoo> if I do `db.collection.remove()`, will it block the whole database or allow me to still write new entries while old ones are deleted?
[14:37:38] <danijoo> (I want to remove all entries of a pretty large database in production)
[14:42:03] <saml> danijoo, why not just drop collection?
[14:42:47] <saml> how big is your large database in production? 2GB?
[14:47:00] <danijoo> the db is more like a giant cache to limit queries against a 3rd party api
[14:50:44] <Sna4x8> When querying, why is it that the AND operations can optionally be an object--{name: 'foo', age: 2}--while the OR must be an array--{$or: [{<expression>},..{<expression>}]}? Is it just a short-hand convenience?
[14:51:34] <Sna4x8> That is, why can't one find({$or: {name: 'foo', age: 2}})?
[14:51:49] <fontanon> Hi! Is this the best irc channel to ask about nodejs mongoose questions ?
[14:55:00] <doc_tuna> fontanon: no, for mongoose, go to mongoose
[15:02:32] <sabrehagen> for those who have mastered using the mongodb native node.js driver, do you any example code that is essentially the 'to-do' app for the driver, i.e. it does all common CRUD application tasks using the optimal design patterns?
[15:02:36] <saml> Sna4x8, {a:b,c:d} and $and:[{a:b}, {c:d}] might not be exactly the same since $and shortcircuits
[15:03:00] <saml> for {a:b,c:d}, c==d might be checked first
[15:03:21] <StephenLynx> sabrehagen that is already done by the driver.
[15:04:25] <StephenLynx> the only thing you need is the documentation http://mongodb.github.io/node-mongodb-native/2.0/api/
[15:04:46] <Sna4x8> saml: Thanks, and I agree with that, but with AND you can use either option. With the former the user doesn't care about the order of evaluation.
[15:05:44] <sabrehagen> what's the commonly accepted counterpart to mongoose's populate functionality using the driver?
[15:05:45] <Sna4x8> With OR it seems like one is required to use the array notation but, just like AND, most (all?) of the time the order is irrelevant.
[15:07:29] <Sna4x8> saml: Futhermore, OR is short-circuit evaluated as well, right?
[15:07:32] <sabrehagen> for a set of documents, you frequently want to expand an object id to properties of the referenced document, the notion of 'populating' the parent document with referenced data.
[15:07:58] <sabrehagen> for an array of documents, how do you do this efficiently with the driver?
[15:08:11] <StephenLynx> an array of documents is called a collection
[15:08:22] <StephenLynx> and I don't have to do anything about it
[15:08:36] <saml> Sna4x8, i don't know. maybe $or does things in parallel and accepts first check
[15:12:10] <sabrehagen> i was hoping you might have grown up if somebody asked you a serious question, but it looks like you don't seek to teach, rather you seek ostracise those coming from a simpler system.
[15:14:01] <Sna4x8> Similar question: Is there ever a time where the order of AND or OR operations matters when querying? (Obviously, disregarding mixing the two operators.)
[15:14:22] <Derick> Sna4x8: i don't think so, unless you nest
[15:14:29] <diegoaguilar> Hello, I connect to a mongolab database from mongoshell giving user and password
[15:14:39] <diegoaguilar> one the same shell I try to "access" to a local database too
[15:14:46] <Sna4x8> Derick: That's what I thought, but I wasn't sure if I was missing a corner case or something.
[15:14:58] <diegoaguilar> with connect function and new Mongo.getDB
[15:15:11] <diegoaguilar> but that won't let me normally use local database (its giving permissions problems)
[15:15:30] <diegoaguilar> how can I access multiple databases
[15:19:16] <sabrehagen> can anybody in the channel shed some light on my populate question above? for those who aren't familiar with mongoose's populate: http://mongoosejs.com/docs/populate.html
[15:19:18] <diegoaguilar> I login to remote, it has credentials
[15:19:33] <saml> var l = new Mongo('localhost').getDB('yolo'); db is your remote. l is local
[15:19:44] <diegoaguilar> then I do new Mongo('localhost').getDB('yolo')
[15:22:41] <StephenLynx> I just have my boards having a field called boardUri and then threads belonging to that board also have a field called boardUri with the value of the board they belong to.
[15:23:08] <saml> sabrehagen, you're looking for a todo app example using node.js and mongodb?
[15:53:10] <sabrehagen> imagine you wanted to serve an api to be consumed by a web app as an alternative to the html version. do you have an internal api layer you could hook that into?
[15:55:04] <StephenLynx> in the docs there is the specification of both the json api controls and the static json data.
[15:56:22] <sabrehagen> i started with the MEAN stack in december 2014 to build a web app. i had never done any web service nor web app development. i could tell having my system be dependent on mongoose was something i didn't want to have, but it was the only immediate way to get going.
[15:56:58] <sabrehagen> i've written an internal api behind which mongoose is abstracted, meaning i could convert the access to the nodejs driver exclusively, or even another database entirely.
[15:57:27] <StephenLynx> yeah, I don't bother with that. my code depends on the native driver and thats it.
[15:58:06] <StephenLynx> it could be changed on the db.js file so it would interpret the commands to be run somewhere else.
[15:58:28] <StephenLynx> but I don't intend to use anything else than I am using.
[15:59:21] <StephenLynx> some dude bitched at me for not abstracting the database and I had to explain him there is no other database that provides the tool I use from mongo
[16:04:30] <sabrehagen> so that's 200 requests concurrently with 70ms response time. that's the kind of beauty you'd hope for from node and mongo together in their rawest form.
[16:04:56] <sabrehagen> i'd like to see how many concurrent users it would support before it exceeded 200ms.
[16:06:33] <Sna4x8> Shoot, with that number of requests (only 200 concurrent) we get comparable (70ms) performance using SQL. With a high level of abstraction, I might add.
[16:07:30] <StephenLynx> yeah, but I don't know what kind of operation you are performing.
[16:07:46] <StephenLynx> on readings I can serve a page in 2ms
[16:09:27] <sabrehagen> StephenLynx: do you consider a database call almost inconsequential? that is, it's just like a direct access memory operation on a json object?
[16:09:42] <StephenLynx> that depends on the operation.
[16:09:59] <StephenLynx> if its a small collection that is accessed frequently
[16:10:05] <StephenLynx> then the overhead is negligible
[16:10:35] <sabrehagen> what's an example of a collection size at each end of the spectrum and the type of query you might run on it?
[16:32:29] <StephenLynx> and a mild challenge to write the real time chat.
[16:32:42] <StephenLynx> the android app was just a matter of time restraint
[16:32:50] <StephenLynx> as in most small business
[16:32:57] <StephenLynx> you don't know what you will have to develop.
[16:33:19] <StephenLynx> so you are always having to learn something new and doing something you never did before
[16:34:36] <StephenLynx> the C software was mostly challenging because I had no idea on any of the involved aspects. I had no idea how raspPis were, I had no idea what was the interface the equipment used, I had no idea on how to use serial ports
[16:34:51] <StephenLynx> I just had some C++ knowledge, so learning what I had to learn from C was not hard
[16:35:29] <sabrehagen> tgis was the serial port comms?
[16:43:52] <StephenLynx> haven't used node since i dunno, 0.10
[16:44:05] <StephenLynx> but I don't think it is much better by now
[16:45:02] <sabrehagen> that sounds like a nightmare.
[16:45:17] <StephenLynx> yeah, imagine compiling that on a raspPi
[16:45:44] <StephenLynx> I even considered at some point trying, but I didn't like the idea because of that.
[16:46:27] <StephenLynx> besides, if you are just going to use node/io as a general purpose scripting runtime environment, you might as well use something else meant to be used for that.
[16:46:55] <StephenLynx> you wouldn't use the single strongest point of it: handling high levels of concurrency.
[17:32:17] <christo_m> hello, im trying to do an autocomplete on movies and shows, should i be storing these as separate collections in my mongodb?
[17:32:27] <christo_m> would it be slower querying both collections?
[19:28:05] <Pinkamena_D> I am looking for an idea to solve this problem. I have a collection with docs with array values: [a, b, c, d]. I have an array of values and I want to query for documents where all of the document's array values are a match but there can be extra. For example [a,b,c] and [a,b,d,e,f,g] should not match but [a,b,c,d] or [a,b,c,d,e] will match.
[19:31:50] <StephenLynx> ok, so what you need is "give me all that contains AT LEAST all of these elements?"
[19:32:51] <doc_tuna> ehershey: irssi is the client of the future
[19:32:59] <doc_tuna> i'll be here, in the future, waiting for you
[19:34:42] <ehershey> the problem is it's also the client of the past