React Native - can't import mongoose on the front end(but it works from the backend)

后端 未结 2 777
抹茶落季
抹茶落季 2021-01-29 05:21

I cant import mongoose on the frontend but it worked on the backend.

I have a separate directory for the backend. I have some code to add a couple users to my database.

相关标签:
2条回答
  • 2021-01-29 06:10

    Just today I found out about Mongoose's browser module while trying to solve similar problems to you. It's a very limited version of Mongoose but will let you do validation against schemas, for example, on the front-end. Sorry I only found this 6 months after your post.

    0 讨论(0)
  • 2021-01-29 06:15

    Mongoose's browser library doesn't support mongoose.connect(). It only supports schemas and document validation, it can't actually connect to MongoDB or save documents currently.

    0 讨论(0)
提交回复
热议问题