Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull request for use with react-native-local-mongodb? #110

Open
Billydubb opened this issue Aug 17, 2017 · 1 comment
Open

Pull request for use with react-native-local-mongodb? #110

Billydubb opened this issue Aug 17, 2017 · 1 comment

Comments

@Billydubb
Copy link

Billydubb commented Aug 17, 2017

Hey,
I am using react-native-local-mongodb, which is basically a fork of nedb adapted for react-native.
To use camo with React Native you have to change and add a few things.
Would you be interested in a PR with the changes I've made for react native or do you think I should put that in a separate repo?

@Billydubb
Copy link
Author

For anyone who might be interested in using camo with react-native, here's what worked for me:

  • install Buffer

    • npm install buffer —save
  • Add Buffer to global namespace in index.js (Buffer is used in validate.js)

    • global.Buffer = global.Buffer || require(‘Buffer’)
  • Install path

    • npm install -D path
    • npm install —save path
  • Uncomment or remove require(‘fs) in nedbclient.js

  • Replace const Datastore = require(‘nedb’) with const Datastore = require(‘react-native-local-mongodb) in nedbclient.js

  • If you want to make this a standalone lib, then you should add the following dependencies to package.json

    • path
    • buffer
    • react-native-local-mongodb
  • Optionally in db.js remove all the mongodb stuff

  • Optionally, remove the mongoclient.js file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant