Wednesday, December 29, 2010

Debugging MapReduce in MongoDB

On a project that I am working on, we are doing some pretty intense MapReduce work inside of MongoDB. One of the things we've run up against is the lack of solid debugging tools. Some Googling basically tells you that print() is all you've got.

We've decided to take a different approach and debug our MapReduce code in the browser. Since the code is JavaScript and modern browsers have really excellent support for debugging (breakpoints, variable inspection, etc.) it's pretty easy to do.

All you need is a web app (or even static HTML file) that will:

  1. Load up one of your documents that you would like to map in the browser. Since the documents are JSON, this is easy. In our project, we have JSON fixture files and a small web app that allows you to choose which fixture to use for testing.
  2. Mock the emit() method. You can just have it write to a Hash that you can inspect later.
  3. Load up the Map and Reduce functions. If you keep these in separate .js files, you can pull them in with a simple script tag.
  4. Bind the map function to the document so that it has the correct context. In a MongoDB mapper function "this" is set to the document that you are mapping. You can easily do this with the bind() function in Underscore.js. I'm sure that other JavaScript frameworks provide a similar function.
  5. Put a link on the page that will let you run the bound function.
This will emulate the MongoDB MapReduce environment, but you can now use the browser's debugging tools.

50 comments:

Maisam said...

If you want to make you free flash website I think you need free flash templates .
Free flash intos is of the best free flash effects that you need.

Angelo said...

Hi Andy,

Many thank's for your great idea and article.
I have decided to implement your idea in the Mongo MapReduce WebBrowser project.

You can play with it with the live demo.

Hope you will like it.

Regards Angelo

Harding Jamie said...

To tell the certainty this is a kind post concerning this topic. I got an unpolluted solution from here. Also I can refer to you all www.hwsolvers.com/programming_project here to get educational helps. However will wait for more posts from the blogger. Thanks a lot…….

Mari said...

look.....http://www.promptessay.com/
Interesting information and cute writing style.This is a cool read ..

Алексей Бондарчук said...

Great post, www.masterpapers.com I enjoyed ready reading it, Keep posting good stuff like this.

Fred Duffler said...

Such interesting theme. http://www.online-essay-writer.org/ I like it.

steve7876 said...

Very Interesting Nichols story Thanks for nice done :)

yakenzu toby said...

Thanks for the amazing content on your blog I am very interested in this article and you have really helped me. I have just told a few of my friends about this on FaceBook and they love your content just as much as I do. ibcbet, judi bola, sbobet, agen bola, ibcbet, sbobet

Sohidul Islam said...

If you'd want to use on-line associated speed up the tactic even faster you will be able to fill out AN application presently and easily hit “send” auto title loans chicago. one among our enticing loan specialists will call you back shortly and assist you finalize your loan. As shortly as you pay off your automotive title loan, we've an inclination to send your title right back to you. start.

Sohidul Islam said...


This is the foremost bit I even have glimpsed you’re cozy and do favour to broadcast you – it's actually fastidious to glimpse that i absorb your powerful paid work. whereas if you anticipated did it terribly} clear-cut kind which will be terribly persuading fast auto title loan. whereas over all I unquestionably planned you and clear in your brain can gaze ahead to extra mails like this. Thanks most.

Ken Michale said...

Nice post and informative one.Awesome ideas are post. Friv | Friv 1 | Friv 3

Vladimir Petriko said...

I've implemented a simple opensource online tool based on this idea. You can get a final MapReduce results or go and debug Map / Reduce / Finalize functions step-by-step right in your browser.

Will appreciate a comments / critic / requests.

http://targetprocess.github.io/mongo-mapreduce-debug-online/

Sang Pemikir said...

I really enjoy simply reading all of your weblogs. Simply wanted to inform you that you have people like me who appreciate your work. Definitely a great post. Hats off to you! The information that you have provided is very helpful. Agen Bola

Zacky van Hardi said...

A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up. Great work. Agen Sbobet

Ethan Harry said...

Really important written content. the information that you shown is hard to faith and many superbly i liked the way you afford things here

Accredited GED Online

Lan Linh said...

Great! Thanks for sharing the information. That is very helpful for increasing my knowledge in this field.
pacman |happy wheels |my little pony games | unblocked games
friv4 kizi 4| unblockedgames unblocked games for kids

marko said...

We have to acquire money from any accessible source. Individual money credit is such a source which helps in giving money to these needs. https://www.aaa1autotitleloans.com/chicago

Facebook Descargar said...

What a great online source of information about this topic. you have done great work. keep continue to sharing such kinds of post. keep it up.
Signature:
download descargar facebook gratis para Android celular and download free descargar facebook apk and descargar facebook gratis , descarga facebook

Whatsapp Descargar said...

I understand what you bring it very meaningful and useful, thanks.
Signature:
download free descargar whatsapp and download baixar whatsapp online and descargar whatsapp gratis , baixar whatsapp gratis

Frozen Juegos said...

Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing.
Signature:
Jugar juegos de frozen en línea gratis, los nuevos de princesa de Disney juegos frozen - la princesa encantadora y linda. Divertirse frozen!

marko said...

The organization you choose to manage for the least expensive auto advance rates ought to have an advance frame that is easy to round out, with a without toll telephone number promptly available on the off chance that you have any extra inquiries. usacheckcashingstore.com/costa-mesa

marko said...

Their issues in taking a credit for auto raise additionally on the grounds that they don't claim a property to take an advance against. Moneylenders have in this way composed new auto credits for inhabitant. The advance is given in an obstacle free way to occupants or non-property holders. check cashing nearer in fresno ca

Anh Mai said...

I was working and suddenly I visits your site frequently and recommended it to me to read also. The writing style is superior and the content is relevant. Thanks for the insight you provide the readers!
Signature:
Versión en facebook en español descargar a los países hablan Español: facebook entrar direto agora , facebook en español descargar , facebook entrar direto agora

Britney Smith said...

Thank you very much for your post, it makes us have more and more discs in our life, So kind for you, I also hope you will make more and more excellent post and let’s more and more talk, thank you very much, dear.
happy wheels| friv|monster high| shooting games| tetris| 8 ball pool
cool math games| barbie games| friv4school| agario| fighting games

games unblocked said...

Any way I'll be subscribing to your feed and I hope you post again soon.
kids games online
friv 2
unblocked games
juegos de un show mas

Mít Trang said...

I am very happy to read this. Appreciate your sharing
juegos.com
juegos de matar
jogos friv

Yakenzu Toby said...

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. Agen Sbobet, Agen Bola, Judi Online

thị hậu nguyễn said...

Welcome, your blog is great. I have read many of your articles. It's very interesting and meaningful, it helps me have more knowledge about life. - See more at:
happy wheels
super mario bros
pacman
agario

Hieu Nguyen said...

When you see the stress in work, life, friv could well be a good site to try. thanks you for sharing
Friv Games, Friv Online, Friv.com, Friv

Hieu Nguyen said...

Play free Friv games flash online games flash.
Thanks you for sharing
Friv Games | Friv Online

sky sky said...

I just wanted to thank you for the information, it really necessary and timely for me at this time. Career choices are not merely looking for a job offer income because sometimes it will affect your whole life later. With many new people looking for work often go to work simply how to get a job matching capabilities, can provide income to cover life. The demand for employment as soon as possible sometimes make quick decisions and they forgot that profession is not simply what they do, but also can be an important crossroads in life.!
G9 , Dora Games , Kizi new , Huz 2 , Kizi 2 , Friv 4 School , 85 Play , 4223 Games , 85 Games

Online Game said...

You need to kill time, you need entertainment. Refer to our website. hope you get the most comfort.
Thanks you for sharing!
Friv
Friv Games
Yepi 4
Kizi 4

Online Game said...

you'd have time to look these kids active. Please visit our website and let us play the game interesting.
Thanks for sharing !
Friv 10
Kizi 10
Yepi 2

Shan Jonson said...

The enactment of a additional authority in Constantinople (modern Istanbul) in 306 AD by the Emperor Constantine gave Rome admission to the abundance of Byzantium, and facilitated the bogus of added gold in the anatomy of bezants which rapidly fabricated their way westward beyond the absolute affable world.
cash advance loans in fresno ca

Shan Jonson said...

They would abide to be acclimated for the abutting 100 years until Rome was beat by barbarians from arctic Europe, and the authority succumbed to the aeon of black alleged the Dark Ages. Trade accomplished to abide in the West while it flourished in Byzantium and the Arab world, which had admission to gold agitated beyond the Sahara from abysmal aural Africa to trading centers like Timbuktu.
payday loans chicago

Jhon Paulo said...

With added than 20,000 lenders alms payday loans in the United States, you would be astute to boutique about a bit and acquisition the best deal. You're attractive for the everyman APR you can find, which agency that your anniversary amount of absorption will be lower. As continued as you can handle the quick borderline of the payment, you can account from payday loans.
Check Cashing

Jhon Paulo said...

Payday loans are abbreviate appellation loans which are appropriate to be paid aback by the abutting payday. Appropriately the administration of these loans is absolute short, abiding for aloof 2-3 weeks. The bulk of accommodation is baby and can ambit from £500 to £1500. The absorption bulk for this array of accommodation is on the college ancillary but back the administration is absolute baby the absolute absorption bulk does not bulk to much.
payday loans

Big Brother said...

Everybody has the appropriate to annual loans to accomplish their requirements. Best of the borrowers adopt to annual loans which do not appoint any restrictions on the acceptance the loans. Now, who wouldn't demand to annual loans at a lower bulk of interest? Yes, bargain claimed loans can be the appropriate best for those attractive advanced to accomplish such needs.
Cash Advance San-diego

Online Friv said...

You need to kill time, you'd have time to look these kids active. Refer to our website. Hope you get the most comfort.
Thanks for sharing !
Friv 5
Kizi 1
Yepi 3

Shan Jonson said...

When you accomplishment reading, you should acquire a bigger feel of what allowances there are for you aback you adjudge to get a new debit or analysis or coffer card, abnormally a debit agenda with a banknote aback congenital in.
cash advance loans

Hieu Nguyen said...

When you're tired, you want to relax after a stressful working hours, you need to have time to take care of the kids active.
Please visit our website and play exciting flash games.
Thanks you for sharing!
Friv 4

Kelly Anni said...

I definitely enjoying every little bit of it. It is a great website and nice share.
Signature: slither io | wings io | science kombat | tank trouble 4

Kizi200 Games said...

Play the Best Free Games! We've picked out the racing games, cooking games, candy crush, games shooting, fashion games, ...
Thanks for sharing !
Kizi 200
Friv 1
Y88
Y9

H. Rosario Amber said...

Would be awesome to know where I are able obtain it. Please maintain up the very good job. We all require far more such website owners like you on the net and much fewer spammers. Fantastic mate! Jean Claude Van Damme | Jean Claude Van Damme | Jean Claude Van Damme | Racing Games

Lopez Alexander said...

This content is written very well. Your use of formatting when making your points makes your observations very clear and easy to understand. Thank you.
- usps tracking
- iphone 7 release date
- excel

Online Friv said...

You'd have time to look these kids active. Please visit our website and let us play the games interesting.
Thanks you for sharing !
Friv 100
Friv 8
Friv 2

Justin said...

Best of all, there are a plenty of organizations out there willing to give you a private advance union. They will investigate your understudy credits, see where the advances originated from and what premium rates the advances convey, and after that they will get on the task instantly, conceivably sparing you hundreds, even a huge number of dollars throughout the following couple of years. payday loans chicago

Justin said...

Thus, an important component of the budgetary reserve funds new advance law will create, will be reoriented towards Pell gifts. What's more, pardoning is achievable following 20 years rather than 25 years. Check Cashing San-diego

Friv4 Games Online said...

Thanks for sharing the information. It is very useful for my future. keep sharing. Can you play more games at :
happy wheels | friv4school | happy wheels

Online Friv said...

You want to relax after a stressful working hours. Refer to our website. Hope you get the most comfort.
Thanks for sharing !
GirlsGoGames
Kizi 100
Frvi