[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?
[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?
[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: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: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: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: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: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: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
[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: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: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: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: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: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: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: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: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: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: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: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: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.
[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.
[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.)