[08:26:02] <Dearvolt> Hello everyone :) I'm having trouble getting an update to work on an array nested within some objects and arrays. I am using the Node MongoClient driver. Some code snippets and further explanation are here: http://pastebin.com/bH1hXYi7
[08:26:36] <Dearvolt> I would really appreciate any help :) Not too familiar with Mongo yet and things have been going slowly.
[08:29:31] <Dearvolt> I think I might need to use the positional $ operator?
[08:30:39] <Derick> Dearvolt: looks like a typical relational approach to something...
[08:31:03] <Derick> Dearvolt: instead of storing the fileid in the files[] arrays, store the *section* ID (which you need to add) with file itself.
[08:33:24] <Dearvolt> @Derick: Hahaha, sorry. It has been tricky getting used to the NoSQL approach; It's a completely different mindset. Would I need to assign a unique ID to each section? Or would I just need to store module and section name then search the files collection for anything that matches later on?
[08:36:48] <Derick> cause updating nested arrays is tricky
[08:38:08] <Dearvolt> Thanks so much for your help! I'm going to work on that now and I might pop in later again, but I should be good for now. Was just struggling with updating that nested array.
[08:38:34] <Dearvolt> I found code explaining how to update something that's one level in to an object, but my arrays are nested quite deeply.
[08:38:54] <Derick> and that's usually a sign of doing a wrong schema
[08:39:43] <Dearvolt> One of my lecturers told me we need to denormalize as much as possible, so I figured I would need to store as much as possible in a single object?
[08:40:18] <Dearvolt> But it makes sense to remove the files array. Do you think it would be worthwhile separating pages as well? Or sections?
[08:49:57] <Dearvolt> Thanks for your help! I really appreciate it, @Derick :)
[16:43:39] <hans_> Hi. What approximately (or asymtotic estimate) is the cost of adding a compound index (say {app_id: 1, _id: 1}) to a, big, collection?
[17:56:37] <mw44118> Hey cool kids, I need help loading a medium-size mongo database into my laptop. I used mongorestore to load it, and all goes well until it rebuilds indexes. Then the OS (linux) kills mongod because of memory usage.
[17:57:13] <mw44118> I have 4gb of memory. I set the config cacheSizeGB to 1GB.
[17:57:22] <mw44118> But rebuilding indexes kills me!
[18:04:46] <cheeser> i honestly don't know. depends on your load.
[18:05:54] <mw44118> cheeser: OK, I'll set swap to 2x memory, so 8gb
[18:40:26] <gvandyk> Hi all, I have a question regarding text indexes on mongo collections... is it possible to create an index on a nested object's values, if the nested object's keys are unknown? So what I'm looking for would be analogous to a wildercard ($**) on a nested array, a la... { "tags": [ "Linux" ], "refs": { "somekey": [ "I would like to be able to search
[18:40:26] <gvandyk> for keywords within this value", "This too", "Well, all values within this array, really..." ] } }
[18:41:14] <gvandyk> "somekey" would be unknown. I'm looking for a performant way to use text indexes here, aside from putting a wildcard index on the entire collection
[19:31:46] <MacWinner> is there a simple way to log queries that are not using an index? is it just increasing the profiling level and adding a millisecond query time?
[20:24:03] <herriojr> it's my first time using mongo, and I was given a tar.gz which was produced by the cloud services which is supposed to be a backup, how do I actually restore this tar.gz to a local mongo db? I tried the whole unzip it and point a mongod to that directory, but it doesn't appear to recognize the tables at all
[20:42:21] <AvianFlu> I had that problem the other day, it was only importing the oplogs because I was pointing it at the root instead of the db folder
[21:07:01] <thebigredgeek> Hey, anyone here have experience writing mongoose middleware?
[21:07:17] <thebigredgeek> I am looking for a way to link a pre and post hook together
[21:07:24] <thebigredgeek> Like an "operation context"
[21:07:32] <thebigredgeek> That could be via an operation UID, or whatever
[21:08:00] <thebigredgeek> I am trying to integrate statsd into mongoose to profile query times, and to do this I need a way to attach a "start time" to an "operation context"
[21:08:09] <thebigredgeek> and then measure the difference in a post hook
[21:11:21] <herriojr> AvianFlu: when importing the db, I tried pointing it to the db folder within the backup and I get that — I also tried pointing it to the root as well
[21:21:29] <herriojr> there's restoreInfo.txt, seedSecondary.sh, then each of the subfolders such as "admin" with things such as "admin.1" and "admin.ns"
[21:53:37] <ashp> Hey guys, I'm hoping for some help.. We're running mongo 2.6 (long story, working on it!) and we're having a lot of problems with really slow queries. Looking in the slow log I see one "remove" op taking 120 seconds. All it does is a remove with a _versionId query
[21:53:45] <ashp> I believe I already have an index for this, but it still seems to take forever
[21:53:57] <ashp> do indexes help with remove stuff? (I'm an ops person, and relatively mongo clueless, trying to get up to speed)
[21:57:27] <AvianFlu> so we did one thing at a time
[21:57:34] <ashp> so we're going to have to do a 3.2 update next and see what breaks all over again
[21:57:47] <AvianFlu> it's not as bad as the auth change, from my experience :)
[21:57:54] <AvianFlu> not running 3.2 in prod yet though
[21:58:37] <ashp> cheeser: yeah, we were able to move to WT in staging, so it's definitely possible
[21:59:00] <ashp> We've been in a situation where someone took a mysql database, slammed it into mongo, then we had zero people with any real mongo knowledge
[21:59:05] <ashp> so it's just kind of decayed since then
[22:00:00] <AvianFlu> they'll be able to teach you about data modelling and stuff too most likely
[22:00:04] <ashp> We're going to have embarrassing conversations like "Can we build a whole new set of servers, with ops manager, and then somehow join our existing cluster and let it all replicate into 3.2 from 2.6.. or something."
[22:00:07] <cheeser> yeah. you'll love it. between the monitoring and the backup, it'll help take some load off.
[22:00:17] <ashp> yeah, our backups are hourly mongodumps off to s3
[22:00:20] <ashp> I'm sure that's hell on performance
[22:00:33] <AvianFlu> it sounds like you'll need some in-house data modelling knowledge too
[22:00:43] <AvianFlu> which mongodb can probably provide some consulting on via enterprise stuff
[22:00:43] <cheeser> you can just build a replSet and add the new members and then decommission the old ones as the new ones sync up
[22:00:48] <ashp> AvianFlu: Yeah, it's a mess and I can't imagine it getting better quickly
[22:00:56] <cheeser> you're friendly TSE can walk you through it. :)
[22:01:00] <AvianFlu> shoving an old mysql into a mongo... you're probably doing a few things wrong
[22:01:11] <AvianFlu> and that's likely a piece of the performance fail
[22:01:22] <ashp> I found we have a whole clone of the production cluster for reporting as we didn't know we could just use a replSet with a tag (I think that's the right term)
[22:01:37] <ashp> AvianFlu: Oh it definitely is, we can make all the indexes we like but the fundementals are wrong
[22:01:46] <cheeser> you can use a secondary for reporting if you don't mind some staleness.
[22:01:57] <ashp> The consultant who helped us audit what we've got last week was very polite about telling us "you're doing it all wrong you crazy people"
[22:02:02] <cheeser> 3.4 will make that even nicer with a staleness threshold
[22:02:10] <ashp> cheeser: given that we found in the audit that prod and the reports is already out of sync
[22:02:15] <ashp> we definitely don't mind some staleness
[22:02:33] <ashp> Is there, other than official docs, any book you guys tend to recommend to people trying to come up to speed from scratch
[22:03:16] <AvianFlu> books about the last 5 years of tech tend to be outdated by the time they're on shelves to be sold :)
[22:03:40] <ashp> yep, even "this guys blogs are great" would be helpful, just some source of relatively up to date info
[22:04:04] <ashp> the docs at mongodb.com are pretty good if you know what you're actually trying to do
[22:04:17] <AvianFlu> I'm not really sure offhand, I'm in the position where I tend to just go google chasing specific problems
[22:04:25] <ashp> my trouble is I don't know what I'm trying to do, so trying to navigate replsets vs shards vs secondaries (which I didn't even know existed) is where it's tough
[22:04:27] <AvianFlu> so I've read some good stuff lately but I didn't really save any of it