background preloader

MongoDB

Facebook Twitter

Using MongoDB via .NET. Objective : In this post i will explain how can we interact with data residing in MongoDB using .Net. Ingredients : Mongodb-win32-i386-2.2.3 , Microsoft Windows Vista Professional, Visual Studio 2010 Recipe : Setting up MongoDB Configure Mongodb. Make sure you make a “Data\db” directory at drive Root where your MongoDB (Mongodb-win32-i386-2.2.3) folder. For convenience I re-named this(Mongodb-win32-i386-2.2.3)) to MongoDB only, It helps later when we use the command prompt. ( with shorter name ) Open a command line console, navigate to to MongoDb\bin & run mongod, ( primary process to connect with MongoDB server instance ) Open a new command line console, navigate to to MongoDb\bin & run mongo, ( a shell interface to MongoDB ) *Our shell interface should be connected to server listening on port 27017 ( default port ) .NET code MongoDB Team provides Several driver to connect with MongoDB System.

Open Visual Studio 2012 , create new windows forms application. Go to code behind & add namespaces. View presentations on the NoSQL database MongoDB. New LINQ support in C#/.NET driver Robert Stam, 10gen. MongoDB and C# Download sample project - 111 KB Introduction Most likely you have used a relational database and been fairly happy with it. I know I have. Be it SQL Server or MySQL, I know how to use my tools efficiently to push, pull, and transform the data I need. So what am I getting at? As it turns out, there is another type of database. In this article, I'd like to help you get started with MongoDB, from install to your first project.

Getting MongoDB The MongoDB site has a downloads link sitting right at the top. After you have downloaded it, you can simply unzip it anywhere on your box. At this point, you are running the MongoDB server on localhost, port 27017. There is a shell you can run to play around with the database if you'd like. MongoDB Introduction We are going to create a simple little test project that simulates a blogging system.

Experienced OR/M users will notice that there are no identifiers on Comment. MongoDB stores its data in BSON (binary JSON). The C# Project Finally, Some Code!!! The MongoDB Manual. Quick Tip: Using Users in MongoDB | LearnMongo.com. By default a MongoDB install does not use a username/password combination to access the database. No Password, But Why? This is down to the design philosophy of MongoDB which is to push much of the “logic” to the application level and keep the database doing what databases do best! Hence, given the way that MongoDB is normally used it’s generally not necessary.

In a SQL environment you might have multiple users with multiple groups and schemas to lock down different levels of the database, tables, views, stored procedures, etc. … The idea of this is of course to 1) protect data from unauthorized modification or deletion as well as 2) limiting the tug ‘o war between users by clearly defining their rights.

So, you can give the accounting department different privileges then the marketing department or given root access to the developers (of course.) Conversely MongoDB’s design philosophy would pass these (generally) over to the application itself to handle. I Don’t Care, I Still Want Passwords! Tldrio/mongo-edit.