简体   繁体   中英

React Native connecting to MongoLab

I'm currently creating a React Native application for iOS that will have to query a DB, I have decided to use MongoLab . When looking at MongoLab's docs, they recommend to use the MongoDB Drivers when connecting.

I assume that using either MongoLab NodeJS Driver or MongoLab Mongoose Driver is the best method for React Native, however there is a real lack of documentation online for connecting MongoDBs and React Native.

One concern is that ReactNative does not 'allow' npm packages to work as they would in a normal NodeJS project.

I haven't tried this, but I doubt that drivers intended for the Node.js infrastructure will work in JavascriptCore on iOS. If you want to avoid running your own backend you should consider on of the Backend-as-a-Service providers like Firebase ( https://www.firebase.com/ ). If you are not set on MongoDb you could also consider CouchDb which has a REST API. There is also the PouchDb ( http://pouchdb.com/ ) project that is a CouchDb client in the browser.

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