Hello, Im working on a school project with React Native and Express, and was advised to use mongodb as a database. The project must be a mobile app. On web, using the database works fine, but mobile needs extra resources and research tells me to use realm. However realm is being removed, and is currently deprecated, so what are the alternatives to use the Mongodb server on mobile? also, is there a way to get a local mongodb database, such as a file for a short demo?
Hi Anthony,
For this project, Realm would actually be overkill. Your Express server should act as an API between MongoDB and frontend client (either web or mobile). There are various libraries out there for querying an API or building one in Express, but the simplest way would be to use a fetch
which makes a request to your express server, and the server would in turn query MongoDB and return the result.
This is basic client server architecture. It is not advisable to have your clients making direct interactions to your database, as this is a security risk.
Look into guides on setting up a MERN stack (MongoDB, Electron, React, Node).
For example: https://www.youtube.com/watch?v=4nKWREmCvsE