简体   繁体   中英

how to install .net mongodb driver nuget package in xamarin

does Xamarin work with the .NET mongodb drivers? Tried to install the Mongo 2.2.3 package via Nuget but get the following error:

Adding MongoDB.Driver...
Attempting to resolve dependency 'MongoDB.Bson (≥ 2.2.3)'.
Attempting to resolve dependency 'MongoDB.Driver.Core (≥ 2.2.3)'.
Adding 'MongoDB.Bson 2.2.3' to mdb.
Could not install package 'MongoDB.Bson 2.2.3'. You are trying to install this package into a project that targets 'Xamarin.iOS,Version=v1.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Does anyone have experience with this??

thank you,

Chris

The MongoDB.Bson NuGet package only supports .NET 4.5 so you cannot install it into a Xamarin.iOS project.

If you want to use MongoDB then you will most likely need to create a back end service that talks to MongoDB that your mobile app talks to over http.

There are third party hosting companies, such as mLab , that provide a REST API to access a MongoDB.

Otherwise you could look at Couchbase as an alternative which has support for Xamarin.Android and Xamarin.iOS through Xamarin's component store.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM