Here are a few samples that build on my previous post “Installing MongoDB on a Windows Server.” The following code snippets were developed in Visual Studio 2010 with the IronPython Tools for Visual Studio installed. You can grab these tools here.
The first code snippet queries for the one document that we inserted into the database in the previous post. This just shows a basic connection and query using the C# programming language. The .NET drivers for MongoDB that I am using here, mongodb-csharp, come from the following link: http://github.com/samus/mongodb-csharp.
Next is the exact same code only in IronPython. I had one issue while creating this simple sample. The IronPython code would not load the MongoDB.Driver.dll that I downloaded from github. I had to download the source for it and rebuild it. Then, IronPython would load the assembly.
No comments:
Post a Comment