Tonight we had a very different WAN Party. I have been wanting to learn about document databases for a long time. I tweeted about it the other day and someone mentioned that we should do it together on the WAN party. I thought that was a great idea, so tonight we went about implementing it. I used some screensharing software to show everyone my desktop, then all together we went about removing Linq-to-SQL and adding MongoDB to http://bundl.it. It didn’t take us too long, and we all got to learn together. It was really great, and I hope we can do this more often.
Anyway, I thought it would be a good idea to share what we learned here. MongoDB seems pretty awesome from the little I’ve used it (basically just tonight). You are able to map your objects and store them in really simple ways.
We used these blog posts as references for our education session: Jason Alexander's,
So, the first thing you do is download the executable for Mongo here.
I then opened Mongod.exe to get the server running on my machine, and then mongo.exe to look at and play with our data. What I did next was find a driver so I could access my data from my application (http://bundl.it is written in ASP.NET and C# MVC 3.5 Framework). Someone suggested Norm, it’s a project by Rob Conery and it seemed like it would be up for the task. We downloaded the repo, opened the project, and built it in Release mode. We then went over to the bundl.it solution and included the Norm.dll.
Ok, so, next step was replacing Linq-to-SQL in the bundl.it solution. I gutted all my data access methods, the idea was to get the application back up and working again using MongoDB. The next step was mapping out some classes. There was much dismay at my “BundleManager” class, also my throwing two objects in one class file, however this was for the sake of time and will be fixed before I deploy.
The ease of setting up my objects to Save and Request from MongoDB was suprising. Norm provides a connector class “MongoQueryProvider” within which you pass the name of your datastore as a string. The cool thing is if you haven’t created that particular store yet it will create it for you.
Step next was making sure my objects saved. The syntax on that was “mongoQueryProvider.DB.GetCollection<T>().Insert(object)” or “mongoQueryProvider.DB.GetCollection<T>().Save(object)” (this also does an Update). Retrieving them was just as easy: “mongoQueryProvider.DB.GetCollection<T>().FindOne(new Object {Property = property})”
One thing I loved was the ability to find a list of child objects by passing in the parent using “mongoQueryProvider.DB.GetCollection<Child>().Find(new Child() {Parent = new Parent() {ParentProperty = parentProperty}})” I didn’t have to map out these relationships in a painful ORM manner.
I don’t have enough experience with MongoDB to accurately cover the bonuses and pitfalls. However, the little I have worked with so far I really have enjoyed.
I’m going to make a “tldr;” how-to below to make life easy:
Step 1: Download the mongo executables and unzip.
Step 2: Run the mongod.exe from your command line
Step 3: Run the mongo.exe from your command line
Step 4: Download NoRm
Step 5: Build the NoRm project and Release
Step 6: Include the NoRm dll in your project
Step 7: Create a MongoQueryProvider
Step 8: Add new object
Step 9: Update existing object
Step 10: Retrieve object
Bonus step: Retrieve children via parent.
I plan to do the same “learn together” format for the next WAN. I have an idea of what we will learn, but if you have any desire one way or another let me know.
SARAH! You missed the best part (which, of course, is all of my work ;)...
ReplyDeletevar provider=new MongoQueryProvider(...)
var query = new MongoQueryBundle();
var bundle = query.SingleOrDefault(x=x.ID==1);
LINQ! blog.wekeroad.com/.../using-mongo-wit
Perfect for the beach, the gym or just running around town on a warm summer day, Womens Adidas Shoes come in a wide variety of styles and colors that fit many fashions. Properly broken-in and cared-for Mens Adidas Shoes can provide many years of comfort and use.
ReplyDeleteCharacter is the first and last word in the success circle.
ReplyDeleteIt could be accept by individuals so effortlessly. I assume lots of people will agree with you. You happen to be proper that we are able to to not rely on other people. Who we are able to to count on is ourself.
ReplyDeleteYour post is the best. I like it,because I learn a lot of useful from your blog,thanks.
ReplyDeleteI have been playing around right here for long but this is the first time I write a comment which I hardly ever do in the past.
ReplyDeletethomas sabo rings
ReplyDeletethank you !
Welcome to visit our web shop,the watch is hight quality!
ReplyDeleteI love you post!!
ReplyDeleteI wish complete happiness for my children.
ReplyDeleteYou're fantastic.Continue to work hard.
ReplyDeleteThe secret of being miserable is to have leisure to bother about whether you are happy or not .
ReplyDeleteIt is our common wish to seek sustained world peace and global economic prosperity.
ReplyDeletegood advice is beyond all price.
ReplyDeleteHe is a good friend that speaks well of us behind our backs.
ReplyDeleteon the WAN party. I thought that was a great idea, so tonight we went about implementing it. I used some screensharing software to show everyone my desktop, then all together we went about removing Linq-to-SQL and adding MongoDB to http://bundl.it. It didn’t take us too long, and we all got to learn together. It was really great, and I hope we can do this more often.
ReplyDeleteNever too old to learn.*
ReplyDeleteKnowledge is important for us!
ReplyDeleteoh so funny*
ReplyDeleteI love all the sets!
ReplyDeletexoxo
ziyou de jieshou, ziyou de geini, yu bolatu weiyou!
ReplyDeleteI often dream of that clueless closet app as well. (My first Java applet was a dress-up game.) I think it'd make a good mobile app - take pics of your clothes or draw them, catalog them, remember your favorite outfits. Bonus if it super-imposes them on you and tweets them out for ratings.
ReplyDeleteoh so funny* Everything is lively and lovely
ReplyDeleteI hope youer have a merry christmas.
ReplyDeleteWow, the eBook is incredibly helpful. Having just started my own blog and consulting services I have a long to-do list. Thanks for the post!
ReplyDeleteThis was a really fabulous website! I was luck to search for your theme in blog.
ReplyDeleteThe ease of setting up my objects to Save and Request from MongoDB was suprising. Norm provides a connector class “MongoQueryProvider” within which you pass the name of your datastore as a string. The cool thing is if you haven’t created that particular store yet it will create it for you. http://www.mbtusasale.com
ReplyDeleteTonight we had a very different WAN Party. I have been wanting to learn about document databases for a long time. I tweeted about it the other day and someone mentioned that we should do it together on the WAN party. I thought that was a great idea, so tonight we went about implementing it. I used some screensharing software to show everyone my desktop, then all together we went about removing Linq-to-SQL and adding MongoDB to http://www.uggsaleaustralia.com
ReplyDeleteAll things in their being are good for something.
ReplyDeleteBelieve that the fate of many people are sensitive, emotional and delicate and very caring.
ReplyDeleteHi thanks for yet another funny and interesting post. Where do you receive your inspiration for all this?
ReplyDeleteCome on, for my asseveration, also for my dream!
ReplyDeleteSo yes there is more change to come in my life, more routines that need to be created. NO NO NO, not the Parliament lights but instead school and a new desire to SUCK IT UP and make it through this entry level position that I arrive at before the crack of dawn so that I can leave as the sun is setting. (yes another habit and work ethic problem I have)
ReplyDeleteYes this only child is drowning in change, when all I really want is a Sunday on a couch with some bad tv and maybe 4 or 5 hours of sleep.
Wish me luck, and keep ya posted ....
Welcome to this great party & enjoyable.
ReplyDeleteGood post,This was exactly what I needed to read today! I am sure this has relevance to many of us out there.
ReplyDeleteCool, have not been able to find the information I was looking for before now, thanks to the blog owners for this master piece work…
ReplyDeleteMay you have enough happiness to make you sweet, enough trails to make you strong, enough sorrow to keep you human, enough hope to make you happy.
ReplyDeleteWow, that you are astounding. I've been subsequent parts of this exceptionally strict schooling regimen and I didn't even know! I have to be a all-natural...no wonder I glimpse and experience amazing so much from the time. It is difficult being this awesome isn't it?
ReplyDeleteThanks a lot for sharing. I hope see you more good articles.
ReplyDeleteBen uzun zamandır burada uğraşırken edilmiştir ama bu ben hemen hemen hiç geçmişte bir görüş ilk kez. rtb
ReplyDeleteThere are three arts which are concerned with all things: one which uses, another which makes, and a third which imitates them. Do you agree?
ReplyDeleteIt’s very rare that you find the relevant information on the net but your article did provide me the relevant information.
ReplyDeleteSo good to get more informed on this and again , thanks
ReplyDelete