PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Wednesday the 17th of June, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[01:37:54] <Jonno_FTW> hi
[01:37:59] <Jonno_FTW> anyone in?
[01:38:49] <rkgarcia> hi Jonno_FTW
[03:24:49] <Jonno_FTW> I keep getting an error that mongodb can't find a spatial index when using $maxDistance, I'm using 2.4.13, do I need to upgrade?
[03:25:14] <Jonno_FTW> the reason for the old version is that it's from the centOS repo
[03:39:41] <joannac> Jonno_FTW: do you have a spatial index?
[04:26:12] <svm_invictvs> Using hte Aggregation pipline ar ethe results available immediately?
[04:26:17] <svm_invictvs> Or do they need to processs?
[04:54:36] <Jonno_FTW> joannac: yes
[04:58:19] <Jonno_FTW> joannac: I have indexes on the field loc of type 2dsphere
[07:05:24] <m3t4lukas> hey guys
[07:06:02] <m3t4lukas> when I use the C driver, how do I specify the value of the $type query?
[07:14:48] <m3t4lukas> nobody ever tried this?
[07:22:05] <m3t4lukas> found it
[07:22:34] <m3t4lukas> if anybody needs it, the answer lies here: https://github.com/mongodb/mongo-c-driver/blob/master/src/mongoc/mongoc-matcher-op.c#L1196
[09:21:45] <jar3k> Hey, wiredTiger engine is much better than MMAPv1?
[09:22:53] <bytee> jar3k: thats a possibility
[09:23:57] <lqez> Visit http://www.acmebenchmarking.com/
[09:24:21] <lqez> there are several benchmarks between engines
[09:24:36] <lqez> I think it's up to your data and usage patterns
[09:25:01] <jar3k> lqez: Nice site! Thanks!
[09:43:13] <pylua> what is the use of shard?
[09:52:09] <jar3k> I just wanted to know what is the difference between those two engines. But now I know, wiredTiger is better wor writes and MMAPv1 for reads.
[11:13:22] <skuaskua> whats is currently best GUI for mongo ? :)
[11:15:01] <sterichards> How can I write a query that will search “where username = ‘x’” and also “where id in iDs” from the following data structure - http://pastebin.com/QumTF82h
[11:16:54] <joannac> sterichards: um, have you read the docs?
[11:17:13] <joannac> that's a pretty basic query
[11:17:50] <skuaskua> joannac: it's easier to ask, than to read the docs, isn't it?
[11:22:02] <joannac> skuaskua: i volunteer my time, and I prefer to help people who make some effort to help themselves first :)
[11:25:05] <skuaskua> sterichards, you heard it ;)
[11:25:50] <joannac> skuaskua: btw i'm not ignoring your question, but i don't use GUIs so I don't have an answer for you
[11:26:07] <joannac> maybe someone with an opinion will show up
[11:28:53] <skuaskua> i dont use gui for mongo as well
[11:28:53] <skuaskua> but i use gui for mysql - phpmyadmin
[11:28:53] <skuaskua> which i find vary handy
[11:38:43] <sterichards> Very helpful, thank you
[12:09:18] <Garito> Hi
[12:09:27] <Garito> is this the place to ask for mongo-connector?
[12:09:45] <sterichards> Seemingly not
[12:09:56] <Garito> do you know where to ask?
[12:10:26] <Garito> besides github
[12:10:27] <sterichards> There’s some helpful people on stackoverflow
[12:10:36] <Garito> something more live?
[12:10:43] <Garito> irc channel or something?
[12:11:59] <sterichards> I can’t help, sorry. But if you do find some where, let me know please
[12:12:43] <sterichards> Stackoverflow is a very active forum.
[12:20:15] <Garito> ok
[12:20:16] <Garito> thanks
[12:20:19] <Garito> lunch time
[12:20:21] <Garito> see ya
[13:18:36] <dreamreal> I apologize for the newbie question, but if I have a document that's mapped like a/b/c (a contains a b, which contains a c, each of which have unique identifiers) can I access c using b's unique id?
[13:19:05] <StephenLynx> can you give an example of a document?
[13:19:35] <cheeser> oh, hi dreamreal! :D
[13:20:18] <cheeser> db.collection.find({"b.foo" : blah})
[13:20:34] <dreamreal> StephenLynx: well, it's an ontology construct
[13:20:52] <StephenLynx> I don't know what is an ontology.
[13:21:51] <dreamreal> conceptset contains concepts, which contain secondary data about concepts
[13:22:04] <StephenLynx> can you give an example of a document in your model?
[13:35:35] <dreamreal> StephenLynx: I'm at a POC stage right now. It's basically a master/detail/detail structure; an ontology has concepts, which have relationships and individuations
[13:35:51] <StephenLynx> so you can't?
[13:36:08] <rakan> Hello everyone
[13:36:20] <dreamreal> I don't have a document yet, no. I'm trying to figure out how to organize the documents.
[13:36:30] <StephenLynx> hm
[13:36:57] <dreamreal> I apologize for being vague. I am not meaning to be - I just don't have more information yet.
[13:37:15] <StephenLynx> whatever you do, then, don't use objects with dynamic keys.
[13:37:39] <StephenLynx> like {id:object,anotherId:anotherObject}
[13:37:43] <rakan> If i had a dictionary of different key names such as {"names": {"name_first": "1", "name_second": "2", "name_third": "3"}} as a subdocument. How do i fetch all document with only if the key of the subdocument matches name_f* ?
[13:37:51] <rakan> so partial search on subdocument keys
[13:38:07] <StephenLynx> instead you should use either subarrays or a separate collection with fake relations to parents. either option have its pros and cons.
[13:38:38] <StephenLynx> rakan, same thing I told dreamreal.
[13:38:44] <StephenLynx> have names as an array
[13:39:07] <StephenLynx> {names: [{name:x},{name:y}]}
[13:40:44] <rakan> StephenLynx: the use case is a more of a key value store... and i want to return keys that match a certain structure
[13:40:54] <rakan> I don't think converting it to an array is an option
[13:41:16] <StephenLynx> will 'name_first' key always be 'name_first'?
[13:41:28] <dreamreal> sounds like another master/detail model, honestly
[13:41:47] <rakan> dreamreal: yea it is more of master/detail
[13:42:19] <rakan> StephenLynx: yes
[13:42:28] <StephenLynx> oh, then I misunderstood.
[13:42:30] <rakan> i can guarantee keys are going to be the same across the same documents
[13:42:54] <StephenLynx> what you could do then, is to remove the 'names' object and have all three directly under the document.
[13:43:00] <StephenLynx> why do you need this hierarchy?
[13:43:32] <rakan> StephenLynx: basically the use case is about storing configuration values
[13:43:41] <rakan> So the document contains user_id, dates .. etc
[13:43:52] <rakan> and the "values" are stored in a subdocument
[13:43:57] <StephenLynx> why?
[13:44:05] <rakan> "component_name.something.something" = 123
[13:44:17] <rakan> why not? :D
[13:44:22] <StephenLynx> overhead.
[13:44:25] <StephenLynx> and complexity.
[13:44:33] <rakan> structure actually
[13:44:37] <rakan> that's how i think about it
[13:45:02] <deathanchor> the best documents are flat, subdocs for "organization" just adds complexity elsewhere.
[13:45:13] <StephenLynx> plus you cannot query on the keys.
[13:45:14] <rakan> ok
[13:45:24] <rakan> So assuming that i have all configs in a flat document
[13:45:24] <StephenLynx> "y if the key of the subdocument matches name_f*" not possible afaik
[13:45:34] <rakan> How do i query it with partial match on keys?
[13:46:16] <deathanchor> rakan: you can't afaik
[13:46:35] <rakan> fair enough
[13:46:38] <StephenLynx> plus if the keys are going to be same across documents, how can you query them?
[13:47:11] <rakan> Same keys for all documents is what i meant
[13:47:22] <StephenLynx> so how can you query on these keys if they are all the same?
[13:48:10] <rakan> So if keys are something like this: "component_name.something.something"
[13:48:21] <rakan> I was thinking about getting configs for component X
[13:48:31] <rakan> keys would exist in X.something.something
[13:48:44] <rakan> structure
[13:48:46] <StephenLynx> so they would not be the same?
[13:48:53] <StephenLynx> and you would have a dynamic structure?
[13:49:04] <StephenLynx> that is awful.
[13:49:08] <StephenLynx> one of the worst mistakes you can make.
[13:49:29] <rakan> wooo
[13:49:58] <rakan> you don't know my use case so this is a misjudgement
[13:50:02] <StephenLynx> lol
[13:50:05] <StephenLynx> :^)
[13:50:08] <rakan> so basically what i have is a list of components, say X,Y,Z
[13:50:11] <rakan> for all documents
[13:50:16] <rakan> configs for X,Y,Z are going to exist
[13:50:33] <rakan> so not very dynamic... as all documents are going to have the configs for X,Y,Z
[13:50:59] <rakan> if i wanted to fetch configs for component X for all entities i have
[13:51:06] <StephenLynx> what does a document represents?
[13:51:20] <StephenLynx> so it groups the X, Y and Z?
[13:51:28] <joannac> rakan: you want projection, i think.
[13:51:36] <rakan> Let's say, a financial application which has multiple components
[14:09:15] <Someguy123> can anyone help me with $pull? I've put full details of my issue on this gist: https://gist.github.com/Someguy123/c8be45323e014144244d
[14:09:24] <Someguy123> for some reason, $pull seems to not work with multiple items
[14:16:29] <jacksnipe> http://docs.mongodb.org/manual/reference/operator/update/pull/ it appears that pull only supports one field, yeah
[14:19:04] <Someguy123> jacksnipe, but if you look, they show an example where they use $lt/$gt against the fields
[14:19:25] <Someguy123> surely if they can use functions like that, multiple selection should be fine...
[14:20:13] <jacksnipe> nvm got it
[14:20:21] <jacksnipe> looks like you're not using $in correctly: http://docs.mongodb.org/manual/reference/operator/query/in/#op._S_in
[14:20:57] <jacksnipe> the array you pass $in seems to be an array of literals, I don't know that yo ucan specify other document fields
[14:21:05] <jacksnipe> could be misreading this a lot though lol
[14:28:36] <Someguy123> jacksnipe, pretty sure I'm doing it the same way
[14:28:38] <Someguy123> { tags: { $in: ["appliances", "school"] } }
[14:28:43] <Someguy123> from the docs
[14:28:55] <Someguy123> contact and username are both just plain strings
[14:32:47] <Someguy123> jacksnipe ? ^
[14:33:55] <jacksnipe> yeah but it's pulling out the elements of tags that are in the js literal array [ "appliances", "school" ]
[14:34:46] <jacksnipe> omfg nevermind, I didn't see "var username= 'john', contact = 'bob'
[14:34:53] <Someguy123> yeah -_-
[14:34:56] <Someguy123> they're defined
[14:35:02] <jacksnipe> lol thought you were referencing the conctacts and username fields my bad
[14:35:20] <jacksnipe> does the query work if you hard code 'john' and 'bob'?
[14:47:01] <Someguy123> jacksnipe, weird... it does work actually, from the mongo command line
[14:47:08] <Someguy123> but not from my NodeJS code
[14:47:11] <svm_invictvs> I asked before, but I'll ask again
[14:47:21] <svm_invictvs> Are the aggregation results instantly available?
[14:47:21] <Someguy123> this is really odd
[14:47:34] <Someguy123> svm_invictvs, what do you mean instantly available?
[14:47:41] <cheeser> svm_invictvs: fsvo, "instant" yes.
[14:47:56] <cheeser> it's not like a hadoop job that comes back to you hours later.
[14:48:10] <cheeser> it's like a query. it's a blocking call.
[14:48:37] <Someguy123> hey cheeser, any idea why my update $pull query works great on the mongo CLI, but doesn't work from NodeJS?
[14:48:46] <Someguy123> https://gist.github.com/Someguy123/c8be45323e014144244d
[14:48:46] <cheeser> so depending on how complex the agg pipeline is and how much data you're processing, it might come back "instantly" or it might take some time.
[14:48:52] <svm_invictvs> cheeser: That's what I was getting at...
[14:48:54] <cheeser> Someguy123: not a node guy. sorry.
[14:49:07] <Someguy123> damn
[14:49:20] <cheeser> my advice: use Java. ;)
[14:49:26] <svm_invictvs> cheeser: "It's not like a Hadoop Job..." pretty much answered it
[14:49:33] <Someguy123> dealing with a strange issue where if I copy and paste the query above into the mongo CLI, swapping out the variables for the actual usernames literally, it works great
[14:49:42] <svm_invictvs> cheeser: What about Map Reduce, same?
[14:49:47] <Someguy123> but from NodeJS, it doesn't seem to work, despite seeing nModified: 2
[14:49:57] <cheeser> svm_invictvs: i was extra careful to not say map reduce since that's a mongo thing. :)
[14:50:29] <cheeser> you *can* wait around for m/r jobs. but since they can write to collections, usually you'd fire it off and check back after a while.
[14:50:36] <cheeser> for long/complex agg jobs, i'd recommend the same.
[14:50:43] <cheeser> with $out in the pipeline
[14:50:46] <svm_invictvs> cheeser: Yeah.
[14:51:18] <svm_invictvs> cheeser: Are they less of a pain in the ass than Hadoop jobs?
[14:51:23] <svm_invictvs> (That's a rethorical question)
[14:51:26] <Someguy123> jacksnipe ^^^
[14:51:48] <jacksnipe> sorry Someguy123 still scratching my head
[14:51:51] <jacksnipe> no clue why
[14:51:52] <jacksnipe> rofl
[14:52:22] <Someguy123> yeah I'm completely lost, especially considering the node query actually says nModified 2
[14:52:30] <Someguy123> so it claims that it actually worked and did stuff
[14:52:35] <jacksnipe> yeah that's crazy
[14:52:40] <jacksnipe> sorry really don't know how to help :(
[14:53:24] <Someguy123> I'm slowly regretting my choice of mongo more and more as I build my application
[14:53:45] <svm_invictvs> Why is that?
[14:54:28] <Someguy123> because I keep running into strange bugs like this, or realizing something that's a 20 character query in SQL, takes 50 lines in mongodb node
[14:54:37] <StephenLynx> first
[14:54:40] <StephenLynx> that is not a bug.
[14:54:45] <StephenLynx> second
[14:54:52] <Someguy123> more like "issues"
[14:54:55] <svm_invictvs> Someguy123: What client are you using?
[14:54:58] <StephenLynx> it doesn't take 50 lines in mongo
[14:55:04] <StephenLynx> not an issue either.
[14:55:09] <StephenLynx> you just don't know how the tool work.
[14:55:25] <svm_invictvs> Someguy123: 'cause, I'm fighting with MySQL qeuries with just as hugely complicated queries.
[14:55:26] <Someguy123> StephenLynx, I'm running the same query in mongo CLI as I am in nodeJS, yet it doesn't work in my node application
[14:55:30] <Someguy123> how is that not an issue?
[14:55:43] <StephenLynx> two drivers, two syntaxes.
[14:55:49] <Someguy123> both return nModified 2, claiming they worked fine, yet the node query didn't actually changer anything
[14:55:53] <StephenLynx> are you consulting the driver's documentation?
[14:56:46] <Someguy123> StephenLynx, it's node-mongodb, there isn't really any good documentation outside of the very basics
[14:56:59] <StephenLynx> http://mongodb.github.io/node-mongodb-native/2.0/api/
[14:57:14] <StephenLynx> are you consulting this?
[14:57:15] <svm_invictvs> I'll reserve my comments about nodejs
[14:58:24] <StephenLynx> and your query is wrong because you are trying to match in the update block.
[14:59:36] <Someguy123> StephenLynx, the documentation for $pull shows them using $lt and other queries within the update param
[14:59:46] <StephenLynx> indeed, my mistake there.
[14:59:48] <Someguy123> it's the only sane way I can think of doing that
[14:59:52] <StephenLynx> try using pullAll
[15:00:03] <StephenLynx> and not using $in
[15:00:32] <StephenLynx> you would probably want to use $elemMatch:{$in:[]}
[15:00:53] <StephenLynx> $in by itself is just checking if the array matches the one you are passing
[15:01:01] <StephenLynx> elemMatch is the one that will try and match the elements.
[15:01:15] <Someguy123> oh, I misunderstood pullAll, from a quick look it sounded like something that would clear the array
[15:01:49] <Someguy123> seems like pullAll should do the job
[15:02:06] <StephenLynx> reminder to not use $in in the update block.
[15:02:16] <StephenLynx> with the pullall
[15:02:26] <Someguy123> I know
[15:04:24] <Someguy123> ._.
[15:04:28] <Someguy123> it's not working from node
[15:04:31] <Someguy123> but works in the CLI again
[15:04:48] <Someguy123> now I'm just confused
[15:05:44] <Someguy123> StephenLynx, https://gist.github.com/Someguy123/6105a7ef5e22d308473c
[15:06:17] <Someguy123> that code right there claims nModified: 2, but doesn't actually modify the user, yet from the mongo CLI it works fine
[15:06:21] <StephenLynx> let me test that, just a second.
[15:17:06] <StephenLynx> Someguy123 worked for me.
[15:17:52] <StephenLynx> http://pastebin.com/hn0BDLmq
[15:20:56] <StephenLynx> http://pastebin.com/EFG5fcvc updated version.
[15:21:21] <Someguy123> StephenLynx, hm... I'm pretty confused then
[15:43:12] <Someguy123> StephenLynx, here's the full code I'm using, I really have no clue what's going wrong here: https://gist.github.com/Someguy123/a53e39520aea636c0c1d
[15:44:13] <StephenLynx> "async.parallel({"
[15:44:15] <StephenLynx> what is that?
[15:44:41] <StephenLynx> "a_callback" you are not even executing the callback.
[15:44:42] <Someguy123> StephenLynx, async is a library similar to promises, makes things easier when dealing with a lot of mongo queries
[15:44:49] <StephenLynx> no, its crap.
[15:45:05] <Someguy123> update() executes the callback StephenLynx
[15:45:10] <Someguy123> it IS executed
[15:45:13] <Someguy123> thats not the problem
[15:45:50] <StephenLynx> try without this bullshit and print what you have in the collection before and after the update.
[15:45:58] <GothAlice> StephenLynx: Remember: practicality beats purity. "It's crap" is neither constructive, nor helpful. Also watch your language.
[15:48:05] <StephenLynx> GothAlice by anymeans that is practical, that code is unintelligible.
[15:48:56] <GothAlice> Indeed, simplifying problems down to "let's get it working in the mongodb shell" is a valid support approach. "stop it, it's crap" is not.
[15:49:29] <StephenLynx> I just gave him the whole code he needed. he couldn't make it work and said "I'm confused"
[15:49:35] <GothAlice> And looking at it, it's no more unreadable than any other JS I've seen suffering from callback hell. ;)
[15:49:44] <StephenLynx> thats because you read bad code.
[15:49:55] <StephenLynx> that is as bad as any other bad code.
[15:50:24] <GothAlice> Yup, you totally know me. ¬_¬ Why do you keep over-generalizing?
[15:50:38] <StephenLynx> " I've seen suffering from callback hell"
[15:50:44] <StephenLynx> YOU said it suffers from an issue.
[15:51:10] <StephenLynx> its like saying "I saw people dying from shots to the head". Well, I dare to say shots to the head are quite lethal then.
[15:51:41] <GothAlice> Someguy123: In the example you provided (https://gist.github.com/Someguy123/6105a7ef5e22d308473c) I see a "callback" third argument to collection.update. In the shell, that's not a thing, FYI.
[15:51:59] <Someguy123> GothAlice, correct, that is NodeJS code, without the callback in the shell it's perfectly fine
[15:52:00] <GothAlice> Sorry, fourth.
[15:52:06] <GothAlice> Cool beans.
[15:56:45] <GothAlice> Someguy123: I will admit, my lack of familiarity with JS, and async.parallel in particular, is thwarting my brain's attempt to grok the code. Is that defining new functions for later execution, or is that saying "actually run all three of these in parallel right now"?
[15:57:05] <Someguy123> GothAlice, it means run all three in parallel, and once all three have completed, run callback
[15:57:28] <Someguy123> so once they've all finished and returned data to a_callback, the final callback paramater of parallel runs
[15:57:34] <GothAlice> Cool.
[15:57:50] <GothAlice> That's… highly dangerous, as it stands.
[15:57:52] <Someguy123> if any gives an error as the first arg, it automatically stops execution of any of the others and returns the callback
[15:58:01] <GothAlice> Except for any that have already succeeded and returned.
[15:58:07] <Someguy123> yeah
[15:58:11] <GothAlice> Thus… dangerous.
[15:58:32] <Someguy123> possibly, but I'm not running a bank here
[15:58:35] <GothAlice> I.e. the pulls might work, but the adds wouldn't have happened yet. ;)
[15:58:52] <GothAlice> Boom, missing contacts.
[15:59:15] <GothAlice> MongoDB can't do parallel, BTW. All database operations are handled in a linear fashion.
[15:59:17] <Someguy123> sadly MongoDB doesn't exactly have transactions
[15:59:33] <GothAlice> Someguy123: Actually… http://docs.mongodb.org/manual/tutorial/perform-two-phase-commits/
[15:59:37] <StephenLynx> wait, wait, so in the end his problem was the library?
[15:59:43] <Someguy123> no
[15:59:43] <GothAlice> StephenLynx: No.
[15:59:52] <StephenLynx> because it would run the update while it didnt had run the inserts?
[15:59:54] <GothAlice> The library is besides the point.
[16:00:09] <GothAlice> The three operations being run in parallel are independent of each-other.
[16:00:10] <StephenLynx> so it would insert after removing?
[16:00:44] <Someguy123> welp I have ugly callback ridden code here now, and it works
[16:00:56] <GothAlice> Someguy123: I'm sad to say I don't see anything technically wrong with that code. All of the MongoDB operations appear to be OK, if not following a code style guide. ;)
[16:00:58] <StephenLynx> so it IS the library?
[16:01:24] <Someguy123> it's strange because I use AsyncJS all over my application for MongoDB without issue
[16:01:36] <GothAlice> StephenLynx: We don't really know that, no.
[16:01:48] <StephenLynx> oh, we don't. of course. when he tried without the library it worked.
[16:01:57] <StephenLynx> so it might be a goblin in his HD.
[16:02:15] <StephenLynx> ¯\_(ツ)_/¯
[16:02:18] <GothAlice> "If I throw away the entire module that contains one bug somewhere in it, it works!" Not exactly bulletproof logic.
[16:02:57] <GothAlice> Assumptions are a good way to write bad code.
[16:03:06] <StephenLynx> as using bad tools.
[16:03:27] <Someguy123> time to add in the extra inserts too, see if it blows up then
[16:06:29] <Someguy123> aaaand it's broken
[16:06:33] <Someguy123> not the libraries fault
[16:06:42] <Someguy123> apparantly my multiple updates are breaking something
[16:06:51] <Someguy123> StephenLynx, GothAlice ^^
[16:08:04] <Someguy123> https://gist.github.com/Someguy123/6055325c9c0c2deb4ec0
[16:08:19] <Someguy123> warning: this code is really ugly without async
[16:09:30] <GothAlice> You do realize you don't have to nest callbacks like that, right? ;P
[16:09:40] <Someguy123> as soon as I added in "added 1" and "added 2" where it adds the persons to eachothers contacts, it suddenly stops removing the person from their pending/sent contacts
[16:09:42] <GothAlice> You can code those as separate functions, then just pass the function names in.
[16:09:54] <Someguy123> GothAlice, I know that, but this is just temporary
[16:10:22] <Someguy123> normally I use async which makes it look so much more cleaner (though still not perfect)
[16:11:05] <saml> if i insert/remove a doc and query for it right away i get unexpected result
[16:11:05] <GothAlice> Why are you fetching the user record?
[16:11:08] <saml> is this normal?
[16:11:28] <Someguy123> GothAlice, debugging purposes, doesn't make any difference
[16:11:41] <Someguy123> it shows the before and after update
[16:11:43] <GothAlice> saml: Depends on the write concern you used to do the write.
[16:11:48] <saml> insert({_id:1}) find({_id:1}) gives me no result sometimes. remove({_id:1}) find({_id:1}) gives me result sometimes
[16:12:12] <GothAlice> Aye, the default write concern says "confirm the server got my message", not "confirm the server actually wrote my changes".
[16:12:17] <saml> i'm using reactivemongo (scala). i thought all drivers use correct write concern
[16:12:52] <GothAlice> saml: "Correct" depends on the situation. The default is "confirm receipt". Ref: http://docs.mongodb.org/manual/core/write-concern/
[16:13:09] <GothAlice> http://docs.mongodb.org/manual/reference/write-concern/ for more detail
[16:13:11] <saml> best one is Replica Acknowledged?
[16:13:20] <GothAlice> Again, best is relative.
[16:13:34] <GothAlice> And the more strongly you set the write concern, the slower it will be.
[16:13:50] <GothAlice> So testing is important. But it's also important to not need to do things like re-query for data immediately after inserting it.
[16:14:03] <GothAlice> Since you just inserted it… you _already have the data_.
[16:14:28] <saml> this is for integration test. need to updaet and read right a way fast
[16:14:44] <saml> i guess i'll have to start mongod for testing with different options
[16:14:55] <saml> like.. all in memory no journaling
[16:15:20] <saml> or for tests, use a good write concern
[16:15:33] <saml> let me see if i can change write concern in reactivemongo
[16:15:35] <Someguy123> StephenLynx, any ideas? I don't understand how updates that happen within the callback, can affect the results of the parent function which already executed...
[16:15:55] <StephenLynx> yeah. promises libraries are a cancer.
[16:16:06] <StephenLynx> split your code into multiple functions to avoid callback hell.
[16:16:10] <GothAlice> Except that's not the problem.
[16:16:13] <StephenLynx> gitlab.com/mrseth/LynxChan
[16:16:35] <saml> yah problem is javascript
[16:16:45] <GothAlice> Someguy123: One thing I notice, you're re-using variable names a lot.
[16:17:10] <GothAlice> And because of the nesting, the closures (functions) you're defining will inherit scope.
[16:17:31] <GothAlice> This can lead to non-obvious bugs. ;)
[16:17:35] <Someguy123> GothAlice, I try to avoid that, mainly with callbacks
[16:18:00] <Someguy123> callbacks are the only time I've really had scoping issues like that, so any nested callbacks usually get renamed, e.g. a_callback, cv_callback
[16:18:13] <GothAlice> Someguy123: Have you tried issuing the three updates at the same "level", i.e. not chaining them like this?
[16:18:39] <GothAlice> The first query is modifying fields different from the other two, so shouldn't conflict, and the other two are writing to different documents, so again, shouldn't be a conflict.
[16:18:42] <Someguy123> GothAlice, I assumed chaining them would be the "safest" way that would avoid any weird issues
[16:19:06] <Someguy123> issue is, in the end they need to call the callback
[16:19:11] <Someguy123> that's why I used parallel
[16:19:29] <Someguy123> so all three things can run seperately, then run the callback once all three are done running independant of each other
[16:19:31] <GothAlice> For testing purposes, I'd try without the nesting.
[16:20:07] <GothAlice> A simple way to handle the "call when actually done" thing is to have a counter which each separate update callback increments then checks if === 3, run the final callback.
[16:20:31] <GothAlice> But that's beyond the scope of diagnosing things. Ignore the final callback for now. ;)
[16:20:52] <GothAlice> Oh, you also need to make sure you app isn't quitting before those operations finish.
[16:20:54] <Someguy123> yeah, ignoring the callback right now
[16:21:12] <Someguy123> GothAlice, it's running as a server, so it isn't quitting
[16:21:17] <GothAlice> Cool, cool.
[16:23:08] <Someguy123> okay well that works
[16:23:15] <Someguy123> the three updates run independantly
[16:24:33] <Someguy123> now I just need to figure out why they break in parallel
[16:26:22] <Someguy123> I really don't understand this :/
[16:26:48] <Someguy123> even in series with async, sent/pending doesn't get modified
[16:30:10] <Someguy123> GothAlice, I'm lost now, so with plain JS callback hell, it works, as long as the other updates happen outside of the first updates callback, but when ran in series using async, the two final updates seem to run, but not the thing that removes from pending/sent
[16:34:14] <Someguy123> https://gist.github.com/Someguy123/100e96e840c8fee00acc
[16:34:22] <Someguy123> I'd love to know how those two things are not the same
[16:37:05] <Someguy123> jacksnipe, guessing you have no idea?
[17:16:50] <MacWinne_> what do folks typically set their driver connection timeouts to? I currently have mine at 500ms for php client for no particular reason.
[17:17:18] <MacWinne_> i think I noticed some rare connection timeout issues, so was thinking of increasing this... we have 2 datacenters that have about 30-40ms latency
[17:17:49] <MacWinne_> does the number of nodes in a replicaset or cluster have any bearing on the timeout value that should be set?
[17:17:52] <GothAlice> I don't modify the default.
[17:18:14] <GothAlice> Haven't really ever needed to, and I typically only deviate from service defaults when an actual need arises. ;P
[17:18:28] <Someguy123> I've left mine at the default, no problems even when using MongoLabs
[17:18:42] <Someguy123> if you're getting timeouts, go ahead and increase it
[17:18:53] <StephenLynx> I don't modify the default either.
[17:19:19] <MacWinne_> k.. default for PHP driver is 60 seconds
[17:19:35] <MacWinne_> i'll just leave that then
[17:19:36] <MacWinne_> thanks!
[17:20:15] <GothAlice> MacWinne_: Obv. on PHP it'll be naturally restricted by the PHP allowed runtime duration.
[17:20:41] <GothAlice> A la http://php.net/manual/en/info.configuration.php#ini.max-execution-time
[17:20:53] <MacWinne_> yep.. that too.. i'm almost complete moving to nodejs.. just trying ot keep the php side going on crutches until complete
[17:20:53] <GothAlice> (Defaults to 30 seconds.)
[17:23:15] <MacWinne_> GothAlice, how are the wiretiger patches looking so far.. Are the major bugs you were monitored fixed up in the recent patch set?
[17:23:24] <GothAlice> Let me double check.
[17:24:30] <MacWinne_> if you store an empty file in gridfs, will it take a minimum of 256k for 1 chunk plus whatever bytes the fs.files document needs?
[17:24:48] <GothAlice> https://jira.mongodb.org/browse/SERVER-17386
[17:25:00] <GothAlice> https://jira.mongodb.org/browse/SERVER-17424
[17:25:01] <GothAlice> So no.
[17:25:25] <StephenLynx> they did some patches to it in the 3.0.4 though, so its coming along.
[17:25:27] <GothAlice> MacWinne_: Yes, to your question.
[17:25:56] <GothAlice> Though the document for that minimum chunk will likely be sparse, i.e. not filled with zeroes, so it'll actually take the smallest document size… size.
[17:26:04] <MacWinne_> cool.. thanks for answers to both!
[17:31:42] <MacWinne_> if the vast majority of my files in gridfs are beneath 100kb, is it reasonable to reduce the chunksize?
[17:34:11] <GothAlice> It shouldn't really have an impact.
[17:34:27] <GothAlice> Many small files, that is. One chunk, or one chunk, it's still one chunk. ;)
[17:35:00] <MacWinne_> does the chunksize not pre-allocate the size on disk?
[17:35:22] <GothAlice> No. On-disk allocation is entirely handled by the storage driver, independent of how you use those collections.
[17:35:40] <GothAlice> And there are side-effects for manipulating the chunk size. For example, power-of-two sizes.
[17:36:02] <GothAlice> If you set your chunk size to 1024 bytes, you've actually constructed 2048-byte documents because the _id and BSON structure bumps it over a power of two.
[17:36:22] <MacWinne_> i see..
[17:36:37] <GothAlice> (That is, if the chunk is "full".)
[17:37:02] <GothAlice> This gets more dramatic the larger you go. ;) a 16KB chunk size would accidentally give you 32KB documents…
[17:39:35] <MacWinne_> ahh.. is that why chunk size is 255kb instead of 256kb?
[17:39:42] <GothAlice> Exactly. :D
[18:32:55] <fxmulder> so I've setup sharding to split up my cluster between 2 different replica sets, it appears the original replica set is still growing though
[18:34:09] <fxmulder> how might I go about fixing that so mongodb reuses space that was migrated to the other shard?
[18:34:31] <fxmulder> I'm at 92% usage on this replica set so I'm going to be running out of space soon
[18:41:09] <Epichero> how do i get random results from a mongo query? Opinions?
[18:41:15] <StephenLynx> I have never ran replicas or clusters, but from what I understand, replicas do not split data.
[18:41:35] <fxmulder> replicas mirror the data, shards split the data
[18:41:37] <StephenLynx> shards do split data, though.
[18:41:39] <StephenLynx> that.
[18:42:08] <StephenLynx> so if you set up just replica sets, it wouldn't decrease the amount of data per machine, right?
[18:42:38] <StephenLynx> Epichero, you cannot, afaik
[18:42:57] <StephenLynx> hm, there is a rand() though
[18:43:06] <StephenLynx> A random number between 0 and 1.
[18:43:24] <StephenLynx> it seems to be just on the shell
[18:43:47] <fxmulder> StephenLynx: I have 6 machines, 2 different replica sets of 3 machines each setup with sharding
[18:43:50] <Epichero> yeah, i could do that in my code... I'm just not sure how random that would work out to be
[18:44:04] <StephenLynx> ah, I see.
[18:44:21] <StephenLynx> another thing about space, I read that mongo do not free space back to the system.
[18:44:27] <StephenLynx> it reuses when needed though.
[18:44:38] <StephenLynx> but it won't give it back by default.
[18:44:41] <fxmulder> no, I didn't expect it to free space, I expected it to reuse space, but it keeps consuming more space
[18:44:44] <StephenLynx> hm
[18:44:46] <StephenLynx> then I dunno.
[18:44:54] <fxmulder> I'm going to have a big problem here soon
[18:45:13] <StephenLynx> did you check if the total data among the shards adds up?
[18:45:43] <StephenLynx> to make sure the sharding is working properly?
[19:07:17] <GothAlice> My face. https://gist.github.com/amcgregor/5863ea6d848d192df03c < this query generated by my code is heinous. >_<
[19:08:26] <GothAlice> This… is going to take a while to fix.
[19:42:33] <GothAlice> https://gist.github.com/amcgregor/5863ea6d848d192df03c#file-query2-py < mostly fixed, I think.
[20:09:40] <fxmulder> yeah, the other replica set usage is as expected
[20:10:02] <saml> write concern is per operation? not per connection? is there a way to connect to mongod with default write concern?
[20:12:22] <GothAlice> saml: Yes.
[20:12:47] <saml> http://docs.mongodb.org/manual/reference/connection-string/#uri.w no example
[20:13:07] <GothAlice> Driver?
[20:13:09] <saml> mongodb://localhost/test?uri.w=majority&uri.journal=true
[20:13:14] <saml> reactivemongo
[20:13:38] <GothAlice> Hmm, well, I don't know about that, but in your connection URI, ?w=1 would be what you would add to the end.
[20:13:49] <GothAlice> Being a URI, "additional arguments" are actually "query string arguments".
[20:14:05] <saml> what's j option to w= ?
[20:14:11] <saml> w=majority,j ?
[20:14:13] <GothAlice> Journal.
[20:14:33] <GothAlice> Confirms that even in the event of a power failure, on startup the record will be found in the journal, and committed. (Generally.)
[20:15:05] <saml> > MongoConnection.parseURI("mongodb://localhost/foo?w=1&jornal=true")
[20:15:12] <saml> res0: scala.util.Try[reactivemongo.api.MongoConnection.ParsedURI] = Success(ParsedURI(List((localhost,27017)),MongoConnectionOptions(0,None,true,true,10),List(jornal, w),Some(foo),None)
[20:15:15] <GothAlice> Ref: http://docs.mongodb.org/manual/core/write-concern/#journaled
[20:15:19] <saml> journal,w aren't parsed
[20:15:28] <saml> such poor driver
[20:15:42] <GothAlice> From the looks of it, write-once language.
[20:15:48] <GothAlice> :P
[20:15:52] <saml> yah
[20:16:04] <GothAlice> (Write-once, read-never, that is. ;)
[20:16:41] <saml> write once, delete and give up
[20:17:02] <GothAlice> http://mongodb.github.io/casbah/guide/connecting.html#mongodb-uri
[20:17:21] <GothAlice> The official driver would seem to parse additional arguments correctly. Several are documented on this page alone.
[20:17:36] <GothAlice> And references the official core docs on additional options.
[20:18:41] <saml> yah not sure why they changed from casbah to reactivemongo
[20:18:44] <saml> probably for web scale reasons
[20:19:23] <GothAlice> Or realtime needs. ReactiveMongo does some truly insane in the membrane things.
[21:15:04] <styles> hey guys, I have a user with db access. Can I add it to another db?