PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Friday the 10th of April, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:19:20] <GothAlice> luffy_: http://docs.mongodb.org/manual/reference/command/mapReduce/#output-inline < this page has many mentions of the "BSON document size limit", which you are encountering.
[00:19:48] <GothAlice> luffy_: You can explicitly not perform the map/reduce inline, i.e. the equivalent of the aggregate pipeline $out operator.
[05:36:31] <compeman> hi ops, it would be better if this channel provides "Daily Tips"
[06:04:16] <joannac> compeman: daily tips?
[06:04:36] <joannac> compeman: do you have an example on what kinf of daily tip you would find useful?
[06:22:13] <compeman> joannac: i think performance tips would be very useful.
[06:22:53] <compeman> joannac: or some help scripts would be written in this channel. (getting from mongo docs maybe).
[06:24:42] <joannac> compeman: define "help scripts"
[06:25:39] <Boomtime> where would this daily tip appear? this sounds like a good suggestion for the mongodb blog
[06:26:54] <compeman> joannac: ok, the cost of 'searching in mongo docs' for a IRC bot is useless. ok. but maybe channel bots can daily share some tips or links from mongo blog.
[06:27:26] <compeman> it is just a suggestion, of course there are many people who are willing to help eachother here
[06:28:02] <Boomtime> this is a good forum for interactive help, i think the blog is more suited to the broadcast-style of daily tips
[06:28:53] <compeman> Boomtime: you're right. ok
[08:40:25] <jokke> hi
[08:41:53] <jokke> i'm having some trouble.. what does this error message tell me? failed with error 16837: "cannot use the part (3 of sections.4.page_modules.3._id) to traverse the element ({3: null})"
[09:22:26] <pamp> hi
[09:22:29] <pamp> is normal mongorestore and mongodump be slower with wiredtiger than mmap?
[09:23:22] <pamp> more than 3 times slower
[09:59:44] <al-damiri> Hi #mongodb.
[10:00:06] <al-damiri> Does simply doing `mongodump` will backup all the databases?
[10:24:39] <wawrek> how to query and retrieve embedded documents in mongodb? I am using the aggregation framework in order to query values of embedded documents and I would like to return these grouped by their parent's ids. is this possible ?
[12:03:51] <wawrek> is there anyone online?
[12:06:09] <deathanchor> I am
[12:08:24] <StephenLynx> I am not.
[12:08:26] <StephenLynx> :^)
[12:21:28] <kmtsun> hello everyone
[12:46:59] <wawrek> I am looking for a way of querying embedded documents within an array. I want to return these (sub documents) grouped by their parent id. are there any examples showing how to aggregate and retrieve embedded docs within a list?
[13:14:26] <GothAlice> wawrek: http://docs.mongodb.org/manual/reference/operator/query/elemMatch/ http://docs.mongodb.org/manual/reference/operator/aggregation/unwind/ http://docs.mongodb.org/manual/reference/operator/aggregation/group/
[13:15:55] <deathanchor> unwind was the hardest thing for me wrap my head around
[13:16:28] <GothAlice> It basically duplicates the main record once for each list item; then the field that was a list becomes a single element from that list for each resulting document.
[13:16:54] <GothAlice> $group is effectively the opposite of $unwind. :)
[13:18:09] <deathanchor> let me rephrase, for data I have, I haven't had a use case for unwind yet. had no real world exp with it yet
[13:18:47] <deathanchor> god, why does rs.reconfig sometimes take so long to take effect?
[13:19:15] <deathanchor> now I got this exception: exception: assertion src/mongo/db/repl/rs_initiate.cpp:119
[13:19:30] <GothAlice> Which version of MongoDB, specifically?
[13:19:35] <deathanchor> 2.2.6
[13:19:41] <GothAlice> HAAAAAA
[13:19:42] <GothAlice> Sorry.
[13:19:53] <deathanchor> yeah, it's a real pain
[13:20:16] <deathanchor> should upgrade eventually, but it's a sharded replset... (so many machines)
[13:20:20] <GothAlice> So, uhm, any reason you are't updating that to, I don't know, a supported version? ;)
[13:20:33] <GothAlice> deathanchor: mms.mongodb.com FTW
[13:20:48] <deathanchor> yeah, use that for some basic monitoring
[13:20:55] <GothAlice> (It can handle zero-downtime rolling upgrades for you. But, uh, I don't think it supports 2.2 any more.)
[13:21:07] <pamp> Hi, Its is normal mongorestore and mongodump be slower with wiredtiger than mmap?
[13:22:01] <wawrek> GothAlice: thanks - that's what I found, it looks clear
[13:22:08] <GothAlice> pamp: Depends on the dataset. mongodump/mongorestore are 12% faster on mine if I use WT. (OTOH, my dataset can kill it… so, I still use mmapv1.)
[13:26:08] <wawrek> I would also use $redact to get rid of embedded documents that do not match the query
[13:27:14] <pamp> @GothAlice on mine is the oposite, http://prntscr.com/6s06hp
[13:28:11] <pamp> but okay, I will try to understand the reason for this
[13:28:18] <GothAlice> pamp: What is that output from?
[13:28:25] <GothAlice> I.e. that doesn't look like a terminal mongodump. ;)
[13:29:21] <pamp> is not. is only a notepad where pasted the output
[13:29:48] <GothAlice> What was the exact command line invocation you used?
[13:31:19] <pamp> dump: mongodump --db newModel --collection propertiesBased --out "C:\Program Files\MongoDB\Server\3.0\bin\dumps\planned_network_test"
[13:31:40] <GothAlice> Oh, Windows.
[13:31:44] <GothAlice> That'd have an impact.
[13:31:56] <GothAlice> Windows Server 2008 or newer Windows Server edition?
[13:32:41] <pamp> 2012
[13:32:54] <GothAlice> pamp: http://docs.mongodb.org/manual/administration/production-notes/#mongodb-on-windows — Please install the hotfix.
[13:32:56] <pamp> its a requirement work in windows sistem
[13:33:08] <GothAlice> Yay, Microsoft screwing up virtual memory management.
[13:33:40] <StephenLynx> you really have to use windows?
[13:33:48] <GothAlice> Hmm; no, wasn't that patch.
[13:34:04] <StephenLynx> you know it is insane to run an actual windows server, don't you?
[13:34:10] <GothAlice> (Like, patently insane.)
[13:35:00] <pamp> yes.... unfortunately
[13:36:04] <pamp> yes, but still have to work with windows
[13:36:31] <GothAlice> If only we all had the luxury to fire clients. ;)
[13:36:47] <pamp> the servers are on the azure
[13:37:17] <StephenLynx> lolol
[13:37:31] <StephenLynx> isn't azure that overpriced shitty ms cloud?
[13:38:05] <GothAlice> pamp: Are you able to get MMS in there? It would be able to provide a lot of detail as to the operation of the mongod service during the dump and restore.
[13:38:16] <GothAlice> (I.e. page fault rates, throughput, etc.)
[13:40:01] <pamp> not yet. but I'll deal with it.
[13:40:37] <pamp> thanks for the suggestions
[13:40:49] <GothAlice> Oh! How much memory does your mongod node have available to it?
[13:41:18] <pamp> 64 GB
[13:41:39] <GothAlice> https://support.microsoft.com/en-us/kb/2981965 < here's the right hotfix!
[13:41:41] <GothAlice> Huzzah.
[13:42:24] <GothAlice> Ref: https://jira.mongodb.org/browse/SERVER-13329
[13:43:16] <GothAlice> Also, as a note, I can't recommend WiredTiger for production use at the moment.
[13:44:17] <GothAlice> (Though not because of any performance issue; on non-Windows WT kinda rocks socks in the performance department.) Because of reliability and memory management. (I.e. it doesn't conform to its own documented limits and configurable options, and tends to get OOM-killed in my test cases.)
[13:45:03] <deathanchor> hmmm.. 2.2.6 doesn't like adding and removing a member in a single rs.reconfig()
[13:45:28] <deathanchor> the members fought for a bit about the correct rs.conf(
[13:45:41] <pamp> this system will be in production only in 2016
[13:45:55] <pamp> for now is just for testing
[13:46:58] <pamp> we are developing a new model and the test to see if meets the requirements
[13:49:53] <GothAlice> … two years of at least one 64GB Azure node? (Which I can't seem to find, heh.) *insert low whistle instead of surprised expletive here* $36K (at a minimum) to test something?
[13:50:11] <GothAlice> I sometimes spin up 1000 VMs for an hour to test things, but that only costs $7.
[13:52:09] <StephenLynx> if its for testing why cant a dedicated server be used?
[13:52:40] <StephenLynx> I am pretty sure even linode is cheaper than azure at these insane prices.
[13:52:47] <GothAlice> pamp: Don't think I'm only down on MS, here. I'm also unimpressed by things like Compose.io's pricing. ;)
[13:52:56] <StephenLynx> did someone got bribed so you guys picked azure?
[13:53:09] <StephenLynx> they are like the macs of hosting.
[13:53:49] <StephenLynx> if I had people that oblivious at management on my company I would be looking for a new job ASAP.
[13:54:01] <GothAlice> StephenLynx: Due to longer lasting hardware on average, the increase cost is amortized over a longer time and thus the value is actually greater than Windows machines. (I.e. we still have Macs that are running a-ok after 8 years.)
[13:54:04] <GothAlice> ;)
[13:54:31] <StephenLynx> "windows" machine?
[13:54:54] <StephenLynx> are you talking about a regular pc?
[13:55:10] <GothAlice> Indeed; generic "pc" commodity hardware (towers) and laptops a la Thinkpads, etc.
[13:56:08] <StephenLynx> even if it is a health 8 year obsolete hardware, you are still locked up like hell.
[13:56:16] <GothAlice> How so?
[13:56:34] <StephenLynx> ever tried installing GNU/linux on a mac?
[13:56:46] <GothAlice> Yup; I dual boot Gentoo on my rMBP.
[13:57:06] <GothAlice> (Though mostly that install runs as a VM to let me orchestrate server updates and things.)
[13:57:20] <StephenLynx> last information I got from a mac developer is that installing any OS that is not OSX on a mac is not trivial.
[13:57:42] <GothAlice> It's EFI. Or you can ignore pretty much the whole thing by opening up Bootcamp once to enable BIOS emulation.
[13:57:43] <GothAlice> ¬_¬
[13:58:09] <GothAlice> Sure the built-in keyboard is USB, and that may take a bit of planning in order to have a working keyboard on startup. ^_^
[13:58:10] <StephenLynx> then you got incompatibility issues, I also heard that you can't just use any hardware and install on a mac.
[13:58:39] <GothAlice> Could you clarify that last bit? "use any hardware" "install on a mac" — do you mean "install Mac OS on any hardware"?
[13:58:45] <StephenLynx> no
[13:58:54] <StephenLynx> install any hardware on a mac hardware.
[13:59:03] <StephenLynx> like a new network interface.
[13:59:09] <StephenLynx> or a graphics card.
[13:59:41] <GothAlice> Also, the three USB network interfaces I have both work A-OK. (One of them is a rather open WiFi chip to enable proper promiscuous mode.)
[13:59:51] <GothAlice> Heh, both. All.
[14:00:32] <StephenLynx> and if something breaks you have to replace the whole thing because its all bundled like a laptop.
[14:00:50] <GothAlice> That… is really a non-issue.
[14:00:52] <StephenLynx> lunch brb
[14:01:27] <StephenLynx> also, it doesnt matter if it works after 8 years, it is obsolete by then and you could easily buy new hardware with the amount of money they overcharge for it.
[14:01:36] <GothAlice> I walk into an apple store, hand them my laptop, they take 5 minutes to confirm it's broke, they hand me a new one, and at home or the office I log in and *bam* everything is pretty much ready to go again.
[14:01:54] <StephenLynx> so you need to go to an applestore to have your hardware fixed?
[14:01:59] <StephenLynx> no one else can do it?
[14:02:02] <GothAlice> Or any authorized service center.
[14:02:06] <GothAlice> ¬_¬
[14:02:09] <StephenLynx> that is awful
[14:02:14] <GothAlice> It really sounds like you're trying to invent problems.
[14:02:31] <GothAlice> Your Dell server fails, you call Dell. C'mon.
[14:02:33] <StephenLynx> no, I am sounding like someone who doesn't like to be treated like a dog by its products.
[14:02:53] <StephenLynx> "sit, bark, pay"
[14:11:25] <deathanchor> My workstation only needs be powerful enough to run a terminal and browser. My real work is done on servers.
[14:13:45] <GothAlice> (Automatic updates FTW.)
[14:14:24] <sadmac> *gasp*
[14:14:31] <sadmac> oh god I don't know how I held out that long
[14:15:40] <GothAlice> sadmac: I've used pretty much every OS known to humankind since 1989. ;) I switched from Windows to Linux, then Linux to Mac because I realized I wasn't paying myself to be my own syop, and the frequent need to "fix" things (video, audio, etc.) was hurting productivity.
[14:16:27] <sadmac> GothAlice: not as much of a thing anymore.
[14:17:13] <GothAlice> sadmac: A few months ago I had a user chat me up who updated their desktop Ubuntu install. And broke the video driver. And re-UUID'd the partitions. The box got utterly hosed during a standard update. :thumbs up:
[14:18:25] <sadmac> GothAlice: I haven't had an issue like that in ages
[14:18:33] <sadmac> or anywhere near it
[14:18:38] <GothAlice> (And the number of people I chat with who are *constantly* wrangling with multiple audio routing daemons just to get everything working is very non-zero.) I'm a musician, photographer, sysadmin, and programmer (amongst other things) and need a computer that works for all of those tasks without needing to be "fixed". ;)
[14:19:27] <sadmac> I don't have these problems and I don't know anyone who does. Dunno why.
[14:19:39] <sadmac> And I develop operating systems for a living :)
[14:19:47] <GothAlice> ^_^
[14:20:31] <sadmac> Also you didn't say videographer, which I would have had to give you because linux NLE software is all crap right now
[14:21:34] <sadmac> Heh
[14:21:49] <sadmac> Yeah, trying to use PiTiVi was the last time I felt like I was in the bad old days of linux
[14:22:07] <GothAlice> When I'm in the zone it takes me about two or three hours per minute of produced video… and I used to be able to go for days straight just editing. It's like a form of meditation. ^_^
[14:23:18] <GothAlice> sadmac: I.e.: https://www.youtube.com/watch?v=QqudtctOcdU
[14:23:22] <sadmac> GothAlice: so what do you do for mongodb? Seems like every time I'm in here you're half the chat.
[14:23:33] <GothAlice> sadmac: I… offer support where possible. :D
[14:23:33] <sadmac> GothAlice: at work, shouldn't be watching videos. I'll hit it later though
[14:25:39] <Derick> GothAlice: and that pointed me at https://www.youtube.com/watch?v=7JmveaEopfI :-)
[14:26:10] <GothAlice> Heh, another of mine. I flaied/failed a bit there after running into a parallelization deadlock. ¬_¬ Could have done it in half the time if that didn't happen.
[14:26:33] <GothAlice> I got a recommendation for "MTV - The Head" and had a sudden wave of nostalgia. XP
[14:26:37] <Derick> only "video" I've published is https://vimeo.com/112413380
[14:26:56] <GothAlice> Oh, yeah, Vimeo. ¬_¬ Been a while since I uploaded there.
[14:27:00] <D3add3d> hello I would like to ask how to fix this error: http://pastebin.com/VZEPSej5 (I'm trying to compile the mongo-nonx86)
[14:28:01] <GothAlice> D3add3d: MongoDB only supports little-endian platforms for the server. The tools *may* (possibly should) work, though.
[14:28:30] <Derick> yeah, the server most definitely would not compile on a pi
[14:29:12] <D3add3d> On https://github.com/skrabban/mongo-nonx86/tree/master it states that it is "version of mongodb for big endian processors (sparc, powerpc) and processors that care about alignment (sparc, arm)."
[14:29:51] <GothAlice> Unfortunately, that's a fork. I don't know if the developer of that fork hangs out here, or is awake.
[14:30:20] <GothAlice> Also last updated in 2012…
[14:30:34] <D3add3d> oh... ok... did not notice that
[14:30:51] <GothAlice> Never not look at the commit history and/or change log. ;)
[14:33:42] <D3add3d> Too bad MySQL eats up all the resources so I wanted something little less RAM and CPU intensive
[14:34:08] <Derick> MongoDB is quite RAM intensive
[14:34:24] <D3add3d> under what load?
[14:34:46] <Derick> load has nothing to do with it
[14:34:48] <Derick> data size has
[14:35:49] <D3add3d> ok... but I need only really small db for what I'm working on currently so that would not be a big issue
[14:35:58] <Derick> I suggest sqlite then...
[14:36:10] <sadmac> D3add3d: look at tokyotyrant/kyototycoon if they're still being maintained.
[14:37:23] <GothAlice> D3add3d: All database engines will attempt to consume all available RAM for use as caches. Simple fact; and a good one. Do not mix database services onto hosts doing other things.
[14:38:32] <GothAlice> (It's just not good for write-heavy uses.)
[14:38:41] <Derick> or concurrency
[14:38:47] <D3add3d> GothAlice: I have only one Raspberry Pi and I don't have the money to pay for a hosting
[14:38:50] <GothAlice> Read-only concurrency *can* work.
[14:38:52] <Derick> (well, write concurrency)
[14:38:54] <Derick> yeah
[14:39:16] <GothAlice> D3add3d: On a Pi, use SQLite. It'll work way better in that constrained environment than just about anything else.
[14:39:31] <GothAlice> (Berkley DB might work, too.)
[14:40:45] <D3add3d> I could also just use a simple .json file but I don't like that idea
[14:41:01] <GothAlice> That way lies madness.
[14:41:30] <sadmac> you want indexing
[14:41:33] <GothAlice> Similar to attempting to use a monolithic XML file on-disk. Neither of those are useful "at rest" storage systems as to do anything with it requires effectively full deserialization.
[14:42:07] <sadmac> the old tokyotyrant website just says "We are rearing children" and has a picture of a couple of kids on it
[14:42:14] <GothAlice> YAML, which supports streamed record separators, is only _slightly_ better. (You can seek around in the file and extract just the "record" you want.)
[14:42:14] <sadmac> so I'm guessing no, it isn't maintained
[14:45:56] <sadmac> oh, but it's on github now. Only a month since last commit
[14:46:21] <pagios> hi can i have a column in mongodb that stores dynamic tags?
[14:46:22] <sadmac> oh, forked :(
[14:46:37] <pagios> like call it Tags, and then i can insert into it multiple tags
[14:47:07] <pagios> and do a query later on to select all rows having tags1 and tags 5 for example
[14:47:24] <GothAlice> pagios: Tags are typically done as an array within your document: {_id: ObjectId(…), …, tags: ['foo', 'bar', 'baz']}
[14:47:37] <GothAlice> pagios: To query: db.collection.find({tag: 'baz'})
[14:47:51] <GothAlice> You can also index this type of field and it'll do "the right thing" (i.e. index the nested values).
[14:48:19] <pagios> GothAlice: are they dynamic? can i add them anytime so for example start with 2 tafs, and then if user adds a new tag that array dynamically stores it? no need to predefine the number of tags?
[14:48:43] <GothAlice> db.collection.update({}, {$addToSet: {tags: 'bob'}}) < add a tag
[14:49:02] <GothAlice> (The first {} should be your query to update the correct record, i.e. {_id: ObjectId(…)})
[14:49:19] <pagios> GothAlice: so i can start with a collection with no tags, and then start adding
[14:49:31] <GothAlice> pagios: A list is a dynamic structure, so yes.
[14:50:16] <pagios> to select all rows that have baz and bar i do db.collection.find({tag: 'baz' || 'bar' }) ?
[14:50:51] <GothAlice> pagios: http://docs.mongodb.org/manual/reference/operator/query/or/
[14:53:34] <GothAlice> pagios: http://docs.mongodb.org/manual/reference/operator/query/and/
[14:53:45] <pagios> cool stuff
[14:53:56] <pagios> the dynamic thing is powerful
[14:54:09] <GothAlice> Note the "or of two values in the same field, use $in instead" note.
[14:54:22] <pagios> GothAlice: i have users subscribing to topics, say topic1 topic2 topic1 and something called alltopics
[14:54:32] <pagios> i want to add remove the topics as tags for the users
[14:54:55] <pagios> and then select all subsribers with topic1 and ALL and send them a message
[14:55:03] <pagios> so mongodb can provision such stuff right
[14:56:04] <pagios> like everytime the users sub/unsubscribe from a topic, remove/add the corresponding tag on his row GothAlice
[14:56:17] <GothAlice> Yes, but I must first highly recommend running through a few tutorials, first. Get the basics down ('baz' || 'bar' — not a good sign ;) then definitely search around for specific tutorials on managing tags.
[14:58:38] <GothAlice> pagios: For example, http://docs.mongodb.org/manual/reference/operator/update/#array is the documentation for all of the array update operations. ($addToSet and $pull to add/remove tags.)
[14:58:41] <pagios> GothAlice: yep didnt start yet with mongo
[14:58:57] <pagios> having an eye to see if it is feasible using mongo
[14:59:13] <GothAlice> pagios: Because MongoDB is so different compared to people's typical relational background, it's important to get comfortable thinking the way MongoDB does about your data before you try to really use it.
[14:59:18] <D3add3d> ok I guess I will use sqlite. thanks for advice, bye
[14:59:20] <GothAlice> I.e.: http://www.javaworld.com/article/2088406/enterprise-java/how-to-screw-up-your-mongodb-schema-design.html
[14:59:29] <pagios> i come from mysql oracle background
[14:59:33] <pagios> getting into nosql
[14:59:45] <GothAlice> Then the above article should use "all the right terminology" for you. :)
[15:00:14] <pagios> cool man
[15:00:16] <pagios> thanks
[15:02:31] <GothAlice> pagios: For an example that isn't really directly applicable to your particular use case, http://www.devsmash.com/blog/mongodb-ad-hoc-analytics-aggregation-framework demonstrates how certain changes in how you store your data can affect query performance and storage efficiency. (Naive approach = 133MB data size, 94MB index size. Hybrid approach = 39MB data size, 23MB index size.)
[15:03:01] <GothAlice> Just something for consideration when designing your data structures. :)
[15:03:40] <pagios> i understand that mongodb has no schema means i can start with no array , add some arrays to some rows only and then tags on some othese rows etc
[15:04:47] <GothAlice> pagios: While MongoDB "basically doesn't care", developers should. For example, consider a simple boolean flag in your document. {} (flag missing), {flag: false}, {flag: true} — this greatly complicates your queries!
[15:05:27] <GothAlice> (And can also lead to unexpected bugs.)
[15:05:46] <GothAlice> Oh, and {flag: null}
[15:05:59] <pagios> GothAlice: i will create an array called tagArray and play around INSIDE it
[15:06:00] <GothAlice> Missing and null can be interpreted as "use the default", true/false are explicit.
[15:06:03] <pagios> add and remove
[15:06:22] <pagios> so schema will be the same
[15:07:18] <pagios> ?
[15:07:34] <GothAlice> For sanity sake, it's also important to make sure documents within a collection conform to the same (pseudo-) schema. Storing completely disparate structures in the same collection screws up some indexing assumptions, even if MongoDB lets you do this.
[15:07:36] <Derick> pagios: she means "that looks good" - I think :-)
[15:07:43] <pagios> lol ok
[15:08:01] <GothAlice> pagios: If you have no tags in a document, {tags: []} — an empty list — will help avoid some query pitfalls.
[15:08:20] <pagios> yep i will strt with an empty array
[15:10:36] <pagios> btw is there anything an oracle/mysql.relationanl db that can do that mongo cant do?
[15:10:48] <GothAlice> Joins.
[15:10:52] <GothAlice> Relational integrity checking.
[15:10:57] <GothAlice> Stored procedures and views.
[15:11:08] <GothAlice> Transactions (unless you use the TokuMX fork of MongoDB). Etc.
[15:11:31] <GothAlice> Though MySQL is barely worthy of inclusion in any list that also includes Oracle. ;)
[15:11:51] <GothAlice> (Ref: http://grimoire.ca/mysql/choose-something-else)
[15:12:12] <pagios> can i have triggers in mongo?
[15:12:17] <pagios> procedures
[15:12:17] <GothAlice> No.
[15:12:19] <pagios> ok
[15:12:28] <pagios> need to do that on application level then
[15:12:33] <GothAlice> Some DAL/ODMs offer it, though.
[15:12:45] <GothAlice> E.g.: http://docs.mongoengine.org/guide/signals.html
[15:13:10] <pagios> no constraints too i tihnk
[15:13:26] <GothAlice> Well, you can have unique indexes, but that's about it constraint-wise.
[15:13:38] <GothAlice> Again, data validation is a DAL responsibility.
[15:13:57] <pagios> what is faster to have a join using oracle say or 2 queries into 2 tables in mongo and do the logic on application level?
[15:14:27] <GothAlice> That's the naive approach, and Oracle will be faster due to the extra round-trips. (Maybe; as with anything, this would need to be measured to confirm.)
[15:14:56] <StephenLynx> pagios a relational db would be faster.
[15:15:04] <StephenLynx> because it would make less reads to the disk.
[15:15:16] <StephenLynx> and would optimize said readings.
[15:15:16] <GothAlice> However, faking "joins" in MongoDB is generally frowned upon. There are better approaches. In the example of forums, I store replies to a thread within the thread itself, and store a reference in the thread to the forum it belongs to.
[15:15:48] <StephenLynx> on the other hands, if the limitations of a sub-array are getting you, fake joins are better.
[15:15:54] <StephenLynx> other hand*
[15:16:01] <GothAlice> Because when you're looking at an individual thread you clearly want the replies, and when you delete a thread you want to delete the replies, this structure makes sense. I can then query for "replies 20-39" of the thread, and get the thread details, in one query, for presentation to the web.
[15:16:19] <GothAlice> (This will be faster than a relational join.)
[15:17:12] <pagios> heard of REddit that does an awesome job since it stored the db in RAM vs mongo on disk
[15:17:17] <pagios> redis
[15:18:31] <GothAlice> pagios: http://www.mongodb.com/blog/post/high-performance-benchmarking-mongodb-and-nosql-systems
[15:19:19] <GothAlice> Somewhat relevant, but doesn't include redis. Redis, BTW, contributed to the failure of a five year project I was a member on, a while back. (Django+Redis+Celery = death when you get slashdotted/hackernewsd/lifehackered the same week.)
[15:19:47] <pagios> viber switched from mongo to couchbase
[15:19:56] <GothAlice> Looking at this cart: ouch.
[15:20:06] <pagios> they were using redis+mongo
[15:20:07] <GothAlice> Also ref: https://blog.serverdensity.com/does-everyone-hate-mongodb/
[15:22:15] <GothAlice> pagios: As a weird note, in several deployments I run MongoDB off of ramdisk. (Memory mapped ramdisk files = direct RAM access = blindingly fast.)
[15:22:27] <GothAlice> Most of my database servers don't have permanent storage. (I do this with Postgres, too.)
[15:23:48] <pagios> how do you achieve redundancy? distributed clusters?
[15:24:16] <GothAlice> Indeed. That's how you implement high availability in MongoDB.
[15:24:28] <GothAlice> (Replication FTW.)
[15:27:06] <pagios> i think you need a loadbalancer on frontend to send the database updates to the different nodes of the cluster
[15:27:19] <pagios> coz if the system fails, no replication is possible at that specfic point in time
[15:27:52] <GothAlice> In both cases, I stream the per-minute oplogs to off-site deep storage with weekly snapshots. Worst-case (and I mean very wort-case) if there are zero nodes online (including off-site replica) when a new DB host is spun up it'll see the cluster as down, pull the latest snapshot, and replay all of the logs posted after the snapshot. If there is at least one other node (typically our office off-site replica) it'll stream the latest data off
[15:27:52] <GothAlice> that and go from there.
[15:28:39] <GothAlice> pagios: The client drivers incorporate node discovery and selection.
[15:28:53] <GothAlice> You may have noticed a trend of placing most of the "complex code" in the client drivers. :)
[15:29:31] <pagios> yea but i mean at the minute the node servigin the client fails, the transaction goes with it
[15:29:39] <pagios> if it is being processed
[15:29:43] <GothAlice> Transaction? What's that?
[15:29:49] <pagios> the update/query..
[15:30:07] <pagios> give me few days to get familair with the new mongo terms :)
[15:30:44] <GothAlice> If there's an election called (to determine a new primary in the event of a failure of the current primary) all clients are disconnected and instructed to re-connect post election. It's up to your own code on what to do when this happens: retry, etc. Some queries you might not want to retry.
[15:31:29] <pagios> so the commit happens on the client side
[15:32:03] <pagios> query server, when receive reply, commit on client side that data has been written for example otherwise retry..
[15:32:41] <GothAlice> As there are no "transactions" the concept of a "commit" doesn't apply. Update operations are individually atomic.
[15:33:06] <GothAlice> (Excluding multi-document updates, which if they fail mid-way can cause problems. Thus you can use two phase commits in that situation.)
[15:33:52] <pagios> GothAlice: replication can happen in realtime?
[15:33:57] <GothAlice> In terms of how much checking the client driver does when executing a query or update, there's something called the "write concern". This determines the depth of checking from "ignore every problem, even socket problems" all the way to "make sure this data is propagated to a majority of the cluster, and is committed to the journal" (slowest).
[15:34:31] <GothAlice> pagios: I'm averaging 0.1s replication lag, with occasional 15s spikes I have yet to run down and fix. (I think I still have some unfortunate memory defragmentation options turned on.)
[15:35:08] <GothAlice> The vast majority of operations in my at-work cluster replicate in realtime.
[15:35:18] <pagios> great
[15:37:31] <GothAlice> pagios: https://university.mongodb.com/courses/catalog :)
[15:41:13] <pagios> GothAlice: i use ruby
[15:41:35] <pagios> and i hate .net
[15:44:17] <GothAlice> … that's applicable for a subset of those courses, certainly.
[16:01:32] <pagios> GothAlice: can you add remoe tags from a row without reinjecting the unmodified ones every time?
[16:02:11] <GothAlice> pagios: My previous examples, including links to $addToSet and $pull, all demonstrate how to do that.
[16:02:11] <pagios> for example in mysql if i want to update a json element i need to update["unmodifiedelemtn","modifiedelement2"]
[16:02:17] <pagios> k
[16:02:17] <GothAlice> There is no "re-injecting" at all in my examples.
[17:33:54] <Nomikos> is there a way to sort documents on some key, ascending, while keeping the documents with empty values for that key at the back?
[17:37:34] <razieliyo> I think there is something I'm not getting about mongodb
[17:37:37] <razieliyo> http://pastebin.com/fthDueVz
[17:37:54] <razieliyo> about updating in concrete
[17:38:37] <razieliyo> I thought that would work, given as how it works with find
[17:38:59] <razieliyo> find({"total":1}) looks for all docs that have a "total" set to 1
[17:39:25] <razieliyo> there is more
[17:39:55] <razieliyo> > db.cookiedata.find({count:{$exists:true}})
[17:39:56] <razieliyo> { "_id" : ObjectId("1b062855626c617afa020000"), "count" : 2 }
[17:40:28] <razieliyo> so I guess I have to insert the exact element, not just the fields you want updated
[17:43:49] <Nomikos> razieliyo: update() replaces the object
[17:44:20] <razieliyo> Nomikos, I guess there's no way to do what I wanted, or maybe I could handle a requested object, modify it, then replace existent by that one
[17:44:26] <Nomikos> there is a modifier to make it behave, I think, it's been a while, just diving back into this
[17:44:33] <Nomikos> nah, hold on
[17:44:36] <razieliyo> Nomikos, cool!
[17:44:53] <razieliyo> I'm new to mongo an it rocks, but this has got me hanged for a big while
[17:46:32] <Nomikos> razieliyo: after 'query' and 'update', there is a third parameter options, an object where one of the keys is 'upsert', set it to true to tell update() to "not remove" existing fields
[17:46:45] <Nomikos> razieliyo: see http://docs.mongodb.org/manual/reference/method/db.collection.update/
[17:47:25] <razieliyo> oh, nice! thank you Nomikos!
[17:47:49] <Nomikos> razieliyo: you're welcome. MongoDB is quite a change from MySQL is it not :-)
[17:48:16] <razieliyo> hahahaha it definitely IS
[17:49:03] <Nomikos> I've had fun debugging php issues where, if some other variable referenced the inserted $data variable, $data would /not/ get the _id key after insert
[17:49:27] <Nomikos> this after finding $data /would/ get the _id key whether the insert was successful or not
[17:49:32] <Nomikos> fun times
[17:49:41] <razieliyo> yes, hanging around
[17:50:23] <razieliyo> now the whole code will work! had the same issue in a few places
[17:50:33] <Nomikos> :-)
[18:02:33] <razieliyo> Nomikos, same result even with upsert to true :/
[18:02:48] <razieliyo> creates a new document when no document matches the query criteria
[18:03:00] <razieliyo> I think this wasn't what I was looking for
[18:03:50] <Nomikos> argh
[18:03:56] <razieliyo> np, I did something
[18:04:06] <razieliyo> I just modified the queried object and updated the existing to that
[18:04:17] <razieliyo> works now!
[18:04:26] <Nomikos> I'm an idiot, sorry
[18:04:30] <razieliyo> np man!!!
[18:04:57] <razieliyo> really, you hinted me to the solution somehow in fact haha
[18:05:52] <Nomikos> $set, it was $set
[18:05:59] <razieliyo> :O
[18:06:03] <razieliyo> even better
[18:06:17] <Nomikos> there's a page for that too
[18:06:39] <razieliyo> I'm looking at the same update page, there's some info
[18:06:40] <Nomikos> http://docs.mongodb.org/manual/reference/operator/update/set/
[18:06:47] <razieliyo> :) thanks
[18:08:00] <razieliyo> Nomikos, yay!
[18:08:04] <Nomikos> I wrestled mongodb for 1.5 years, then did nothing for a while, then had to learn&use laravel/angular for 3 months, as of last week it's back to the old project
[18:08:22] <Nomikos> getting re-acquainted with all the things
[18:09:58] <StephenLynx> my transition was very smooth.
[18:10:08] <StephenLynx> I spent a week or so designing the model.
[18:10:14] <StephenLynx> instead of just rushing into coding.
[18:39:09] <MacWinner> GothAlice, do you recommend goign to mongo 3.0.2 but not wired tiger at the moment? or just staying at 2.6.9.. i do want to eventually make the switch the wired tiger for teh storage compression
[18:39:44] <GothAlice> MacWinner: There are many, many improvements in general making 3 a worthwhile upgrade. I've upgrade all of my clusters but one, and I'm doing that one this week-end.
[18:40:27] <GothAlice> I typically stay with defaults; when WiredTiger becomes the default, I'll consider it for production use. :)
[18:44:21] <cheeser> 3.2
[18:46:38] <MacWinner> GothAlice, cool. any particularly salient improvement? reliability is the key for me
[18:46:49] <GothAlice> MacWinner: Write locking is the biggest.
[18:47:09] <MacWinner> ahh.. collection level write locking?
[18:48:02] <GothAlice> MacWinner: https://jira.mongodb.org/browse/SERVER-17444?filter=17503 < 1754 resolved tickets in the 2.7.0->3.0.2 so far.
[18:48:50] <cheeser> document
[18:49:10] <MacWinner> oh, right.. thanks!
[18:49:18] <GothAlice> Well, WT has document.
[18:49:29] <GothAlice> http://docs.mongodb.org/v3.0/release-notes/3.0/#mmapv1-improvements
[18:50:24] <MacWinner> alrighty.. i'll plan on doing the upgrade this weekend
[20:45:34] <Aikar> any way to limit/reduce memory usage of mongorestore?
[21:09:06] <deathanchor> mms doesn't monitor cfg servers?
[21:15:50] <chairmanmow> I'm trying to update a document in a collection from an object that has a value that will be stored in an array. For values that aren't in the array I want to overwrite them, but for the array values, I want to push to the array that's in the document. I've seen the $push and $addToSet operators, but I'm not exactly sure how to structure my query so the other non-array fields will also update. I'm trying to insert an object that lo
[21:24:34] <GothAlice> chairmanmow: db.collection.update({…query…}, {$push: {somearray: somevalue}, $set: {otherfield: othervalue}})
[21:24:41] <GothAlice> $set is a separate operation from $push.
[21:24:59] <chairmanmow> Thanks Alice I'll give it a shot!
[23:04:23] <SoNewbie> hi
[23:04:38] <SoNewbie> I have a design question and I am hoping someone can help
[23:04:47] <GothAlice> Ask, don't ask to ask. What's your question?
[23:06:20] <SoNewbie> Creating an application with erlang, as my web app and creating andriod and ios apps which all are data driven based on mongodb, I would like to know what is the best way to request/minipulate info from these three apps, create an api from them to call? or a web service? is there a common solution to this?
[23:07:30] <SoNewbie> my question do I create a layer on the top of mongodb to make these apps call it to get info and set info to mongodb? or any other database for that matter
[23:07:31] <SoNewbie> ?
[23:09:31] <SoNewbie> Any advice?
[23:11:56] <markin> any ideas on how to make a query like: Model.find(where A=B and if(C=D) { then X = true})
[23:15:03] <markin> SoNewbie: normally if you have a bunch of client side apps, you want an api so that people don't communicate directly to your db
[23:15:58] <SoNewbie> markin: but how do I make this api language-independant?
[23:16:20] <SoNewbie> meaning how to create an api can be called from erlang, php and andriod
[23:16:27] <markin> SoNewbie: you'd normally expose like a rest or soap api and communicate just over http
[23:17:30] <SoNewbie> oh alright... sounds something doable
[23:17:53] <SoNewbie> I will will into RESTful apis, many thanks markin
[23:22:11] <SoNewbie> thanks
[23:22:13] <SoNewbie> good night