As far as I know, you cannot package MongoDB with Electron, it must be installed separately. Quoting from this site: https://www.techiediaries.com/electron-data-persistence/
Pros and Cons of Using MongoDB
For the pros of using MongoDB with Electron apps:
Available for all Electron suppored platforms such as Windows, Linux
and MAC. So it doesn't limit the cross platform feature of Electron.
Can be installed and integrated easily with Electron.
There are also some cons:
- Can't be bundled with Electron so the end users need to install it
separately from your application.
- Overkill for small apps.
Instead, might I suggest using NeDB - https://github.com/louischatriot/nedb
NeDB uses a subset of the MongoDB API so you shouldn't need to alter much code for reading and writing. If you continue reading the link I posted above, it also covers using NeDB within an Electron app.
There are also several other options available that can embed with Electron like NeDB (Pouch, Loki.js) that might suit your needs better.
** UPDATE **
You may be able to use this: https://github.com/nosqlclient/nosqlclient-electron
More info available on the website: https://www.nosqlclient.com/
It looks like it's a replacement application for Electron entirely with MongoDB support, using Electron?