• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by pawel.bubala · Jul 16, 2013 at 05:22 PM · errorreference

MongoDB problem

I add reference MongoDB.Bson.dll and MongoDB.Driver.dll but MongoDB.Driver.dll have reference to MongoDB.Bson and this reference can't load

code:

 public class Entity
 {
 public ObjectId Id { get; set; }
 public string Name { get; set; }
 }
      public class Entity
     {
     public ObjectId Id { get; set; }
     public string Name { get; set; }
     }
     void Start () {
     var connectionString = "mongodb://localhost";
     var client = new MongoClient(connectionString);
     var server = client.GetServer();
     var database = server.GetDatabase("localList");
     var collection = database.GetCollection<Entity>("entities");
     
     var entity = new Entity { Name = "Tom" };
     
     collection.Insert(entity);
     }

and error:

 NotImplementedException: recursionPolicy != NoRecursion not currently implemented
 System.Threading.ReaderWriterLockSlim..ctor (LockRecursionPolicy recursionPolicy)
 MongoDB.Bson.Serialization.BsonSerializer..cctor ()
 Rethrow as TypeInitializationException: An exception was thrown by the type initializer for MongoDB.Bson.Serialization.BsonSerializer
 MongoDB.Driver.Internal.MongoConnection.RunCommandAs[CommandResult] (System.String databaseName, QueryFlags queryFlags, MongoDB.Driver.CommandDocument command, Boolean throwOnError)
 MongoDB.Driver.MongoServerInstance.Ping (MongoDB.Driver.Internal.MongoConnection connection)
 Rethrow as MongoConnectionException: Unable to connect to server localhost:27017: An exception was thrown by the type initializer for MongoDB.Bson.Serialization.BsonSerializer.
 MongoDB.Driver.Internal.DirectMongoServerProxy.Connect (TimeSpan timeout, MongoDB.Driver.ReadPreference readPreference)
 MongoDB.Driver.Internal.DirectMongoServerProxy.ChooseServerInstance (MongoDB.Driver.ReadPreference readPreference)
 MongoDB.Driver.MongoServer.AcquireConnection (MongoDB.Driver.ReadPreference readPreference)
 MongoDB.Driver.MongoCollection.InsertBatch (System.Type nominalType, IEnumerable documents, MongoDB.Driver.MongoInsertOptions options)
 MongoDB.Driver.MongoCollection.Insert (System.Type nominalType, System.Object document, MongoDB.Driver.MongoInsertOptions options)
 MongoDB.Driver.MongoCollection.Insert (System.Type nominalType, System.Object document)
 MongoDB.Driver.MongoCollection.Insert[Task] (AssemblyCSharp.Task document)
 MongoDB.Driver.MongoCollection`1[AssemblyCSharp.Task].Insert (AssemblyCSharp.Task document)
 AssemblyCSharp.Dal.CreateTask (AssemblyCSharp.Task task) (at Assets/AdminAds/Scripts/Dal.cs:66)
 AssemblyCSharp.Dal..ctor () (at Assets/AdminAds/Scripts/Dal.cs:25)
 AddNew.ClickAdd () (at Assets/AdminAds/Scripts/AddNew.cs:11)
 UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
 UIButtonMessage:Send() (at Assets/NGUI/Scripts/Interaction/UIButtonMessage.cs:77)
 UIButtonMessage:OnClick() (at Assets/NGUI/Scripts/Interaction/UIButtonMessage.cs:56)
 UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions)
 UICamera:Notify(GameObject, String, Object) (at Assets/NGUI/Scripts/UI/UICamera.cs:644)
 UICamera:ProcessTouch(Boolean, Boolean) (at Assets/NGUI/Scripts/UI/UICamera.cs:1147)
 UICamera:ProcessMouse() (at Assets/NGUI/Scripts/UI/UICamera.cs:906)
 UICamera:Update() (at Assets/NGUI/Scripts/UI/UICamera.cs:761)

Please Help

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Adding a reference to a project not working 1 Answer

Null Reference Annoying Error 0 Answers

Reference script on Behaviour is Missing, but IT'S NOT MISSING 0 Answers

After instantianting gameobjects, unity cant asign references anymore 1 Answer

Mecanim: NullReferenceException 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges