Using Backbone.js with MongoDB

Submitted by vadim on Mon, 09/02/2013 - 22:44

MongoDB provides data in the Mongo DB Extended JSON format, which looks like following:

{
  _id: {
    "$oid": ""
  },
  first_name: 'Vadim',
  last_name: 'Mirgorod'
}

Everything is OK expect ID, which could not be processed by the Backbone.js out of the box. In this post we are going to learn a solution for solving this problem.

How-to

Such problem can be easily solved by using of Backbone.js extension known as mongo-db, which was created by your obedient servant. To enable MongoDB support you should include this extension to your project and mix Backbone.MongoModel.mixin with Backbone.Model prototype.

_.extend(Backbone.Model.prototype, Backbone.MongoModel.mixin);

This will make all Backbone.Model children to support MongoDB Extended JSON.

Backbone-mongodb overrides Backbone.parse() and Backbone.sync() methods to transform MongoDB Extended JSON into a regular one and back accordingly. Check out the source code of backbone-mongodb.js to understand how it works.

See also

23 comments

This will make all

Submitted by Anonymous (not verified) on Tue, 03/11/2014 - 04:15.

This will make all Backbone.Model children to support MongoDB Extended JSON.Your post is very exciting and informative. I am planning to decide on a career move and The Office Seasons 1-9 DVD Box Set
NCIS Los Angeles Seasons 1-4 DVD Box Set
2 Broke Girls Seasons 1-2 DVD Box Set
Psych Seasons 1-6 DVD Box Set
The Walking Dead Seasons 1-3 DVD Box Set
Sons of Anarchy Seasons 1-5 Box Set
Rules of Engagement Seasons 1-5 DVD Box set

Well I do not know what to

Submitted by Shane Watson (not verified) on Fri, 04/11/2014 - 19:55.

Well I do not know what to say at this point but I am sure that other writers have well explained the issue and these things will be resolved in a much better way. He is one of those brainy guys that think more about their work than devoting their entire season to studying new techniques. Great this Leaks will churn out a couple of essay and stuff like arsenal plus blog essay

to your project and mix

Submitted by Anonymous (not verified) on Tue, 03/11/2014 - 04:14.

to your project and mix Backbone.MongoModel.mixin with Backbone.Model prototype.go wrong. I have visited so many pages with the same discussion and topics

Breaking Bad Season 5 DVD Box Set
The L Word Seasons 1-6 DVD Box Set
Game of Thrones Season 3 DVD Box Set
Chuck Seasons 1-5 DVD Box Set
Cane Seasons 1-5 dvd box set
Walt Disney’s 100 Years Of Magic 172 Discs DVD Box Set

Re:

Submitted by Margaret Boyd (not verified) on Mon, 02/03/2014 - 08:25.

Thanks for this js as it is functionally perfect I must say you are doing it all good.paper editing|essay writers|write my essay for me

Re:

Submitted by Robert Birch (not verified) on Tue, 01/28/2014 - 07:44.

Thanks for this code It is really helpful because of this I am able to complete my work.Do my essay||Essay help||

Aw, this was a really nice

Submitted by gerda12 (not verified) on Sun, 02/16/2014 - 14:35.

Aw, this was a really nice post. In idea I would like to put in writing like this additionally – taking time and actual effort to make a very good article… but what can I say… I procrastinate alot and by no means seem to get something done.personalized watches for men

Everything is OK expect ID,

Submitted by Dorothy (not verified) on Fri, 11/29/2013 - 04:31.

Everything is OK expect ID, which could not be processed by the Backbone.js out of the box. In this post we are going to learn a solution for solving this problem. This is a well written article on this subject. I have been looking at starting a new business and this is valuable information to help me in my decision. Thank you. The Closer Season 7 DVD Box set|
The Closer Seasons 1-7 DVD Box set|
Friday Night Lights Seasons 1-5 DVD Box set|Friday Night Lights Season 5 DVD Box set|Rizzoli and Isles Season 1 DVD Boxset|How I Met Your Mother Season 9 DVD Box Set

*Youre so cool! I dont

Submitted by netuta (not verified) on Tue, 02/11/2014 - 15:19.

*Youre so cool! I dont suppose Ive read anything like this before. So nice to find somebody with some original thoughts on this subject. realy thank you for starting this up. this website is something that is needed on the web, someone with a little originality. Yellow Pillows

i agree with you, i am glad

Submitted by Management information (not verified) on Wed, 12/18/2013 - 18:27.

i agree with you, i am glad to be here thanks for sharing this stuff.

Thanks for the post

Submitted by ioana (not verified) on Wed, 01/29/2014 - 12:36.

*I am often to blogging and i really appreciate your content. The article has really peaks my interest. I am going to bookmark your site and keep checking for new information.
mouse pad

Thanks for the post

Submitted by sara100 (not verified) on Sun, 02/16/2014 - 14:34.

After study a few of the blog posts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Pls check out my web site as well and let me know what you think.
inregistrare domenii

*When I originally commented

Submitted by crina (not verified) on Tue, 02/11/2014 - 15:20.

*When I originally commented I clicked the -Notify me when new comments are added- checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Thanks! web hosting

*I’m impressed, I must say.

Submitted by denisa13 (not verified) on Tue, 02/11/2014 - 15:22.

*I’m impressed, I must say. Really rarely do I encounter a blog that’s both educative and entertaining, and let me tell you, you have hit the nail on the head. Your idea is outstanding; the issue is something that not enough people are speaking intelligently about. Yellow Pillows

This will make all

Submitted by Dorothy <a href="http://boardwalkempireseason1-3dvd.weebly (not verified) on Fri, 11/29/2013 - 04:29.

This will make all Backbone.Model children to support MongoDB Extended JSON. very Interesting information as presented in an interesting way - I hope that you will frequently update your blog. Thanks to sharing interesting article.
Boardwalk Empire Seasons 1-3 dvd box set| The Killing Seasons 1-3 dvd box set| Entourage Seasons 1-8 dvd box set|
Fringe Seasons 1-5 dvd box set| Lie to Me Seasons 1-3 DVD Box Set| Person of Interest Seasons 1-2 dvd box set| CSI Las Vegas Seasons 1-13 dvd box set

Great Post

Submitted by Greta (not verified) on Thu, 01/23/2014 - 23:45.

*This web site is really a walk-through for all of the info you wanted about this and didn’t know who to ask. Glimpse here, and you’ll definitely discover it.
The Best Spinner

An interesting article

Submitted by MICA (not verified) on Wed, 01/29/2014 - 12:37.

*Nice post. I learn something more challenging on different blogs everyday. It will always be stimulating to read content from other writers and practice a little something from their store. I’d prefer to use some with the content on my blog whether you don’t mind. Natually I’ll give you a link on your web blog. Thanks for sharing. gazduire web

Youre so cool! I dont suppose

Submitted by monica (not verified) on Tue, 02/04/2014 - 01:20.

Youre so cool! I dont suppose Ive read anything like this before. So nice to find somebody with some original thoughts on this subject. realy thank you for starting this up. this website is something that is needed on the web, someone with a little originality. useful job for bringing something new to the internet!
ipad air cases

Your good knowledge and

Submitted by marta12 (not verified) on Sat, 03/29/2014 - 00:17.

Your good knowledge and kindness in playing with all the pieces is very useful. This has been one outstanding blog to visit
inregistrare domenii

look forward to your future

Submitted by Flora (not verified) on Sat, 11/16/2013 - 10:46.

look forward to your future updates like something special and good things in it which I always like.
The Killing Season 3 DVD Box Set| Arrow Season 1 DVD Box Set | Game Of Thrones Seasons 1-3 DVD Box Set | Homeland Season 2 DVD Box Set| Revenge Season 2 DVD Box Set | NCIS Seasons 1-10 DVD Box Set

very nice post, i certainly

Submitted by floarea (not verified) on Sun, 02/09/2014 - 15:21.

very nice post, i certainly love this website, keep on it Just Air Ipad Case

*Hello! I just would like to

Submitted by milica (not verified) on Sun, 02/09/2014 - 15:24.

*Hello! I just would like to give a huge thumbs up for the great info you have here on this post. I will be coming back to your blog for more soon.
personalized gifts

This will make all

Submitted by Flora (not verified) on Sat, 11/16/2013 - 04:54.

This will make all Backbone.Model children toon the look for such information
the closer dvd box set|lie tome DVD Box
Set
|star wars the clone wars DVD Box Set|Cheap Californication DVD Box Set|90210 DVD Box Set|Falling Skies dvd box set

we are going to learn a

Submitted by Flora (not verified) on Sat, 11/16/2013 - 04:52.

we are going to learn a solution for solving this problem.Where else could anyone get that kind of touch DVD Box Set|sherlock DVD Box Set|modern family DVD Box Set|Downton Abbey dvd
box set
|Game of Thrones dvd box set|Californication DVD Box Set