The blog has moved to http://jessehouse.com/ ... Many google searches point here so I am leaving it operational, but there will be no new posts.

Tuesday, May 3, 2011

Simple.Data and MongoDB

Get really dynamic with Simple.Data and MongoDB

took me awhile to figure out the proper way to establish a connection with Simple.Data.MongoDB




Resources

You can install all of the dlls using Nuget, search for Simple.Data.MongoDB and install that package it will bring in the rest

Some of the errors I received on my journey

From Simple.Data
Message=No valid exports were found that match the constraint '((exportDefinition.ContractName == "Ado") AndAlso (exportDefinition.Metadata.ContainsKey("ExportTypeIdentity") AndAlso "Simple.Data.Adapter".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))', invalid exports may have been rejected.
And from mongo driver when my connection string was not in the correct format, I was using the wrong port
Message=No connection could be made because the target machine actively refused it 127.0.0.1:

2 comments:

David said...

So what caused that 'No exports' exception and what fixed it? Having the same thing but cannot figure out what to do to resolve it.

House 9 said...

honestly - I can't remember :(

it might have been use of var vs dynamic

// works
dynamic db = Database.Opener.OpenMongo(...

// errors ???
var db = Database.Opener.OpenMongo(...

I haven't done any c# in a few months and only spent a few days with simple.data at the time I posted this

I would contact the authors on github if this doesn't help