Is there a packge providing file Based "Database" instead of mongo?

I am working on a desktop app I want to send to some friends.

It uses Electron.

I don’t want my users to install MongoDB, nor I think it’s needed. The app only saves about 10 keys in a JSON object.

I wonder, whether there’s a package that provides a database API, but instead of saving to mongo it saves to disk? I really like the mongo API and would like to continue using it.

I’m not that familiar with Electron (roughly a web view wrapped in an executable?) but there are packages to help you with using browser local storage, maybe that route could work? Sounds like with so little data it would be an appropriate use of local storage.

What local storage related packages would you suggest?

I am looking specifically, if possible, packages that mimic mongo package API, because I would like to mock out mongo in external packages that use it because it has a reactive API (e.g. bjwiley2:server-watch uses mongo in a lightweight manner, simply because the API is awesome.).

Also, not sure on how to do the mocking, but that’s less critical, I can live on Meteor.calls until I figure it out, I have a feeling it has something to do with Deps.change and all that.

up! still relevant.

Is there a way to have a file-based database, node-js only, as a reactive source?

how would I go about implementing one if there isn’t?

I’m not sure if this is appropriate for Electron but I found this awhile ago. Maybe it could help:

LokiJS -> http://lokijs.org/#/

There doesn’t seem to be an implementation with Meteor JS in mind.

It does seem a lot like what I need. A meteor package with lokijs would need to contain publishing/subscribing abilities, and the the whole syncing collections between the server and the client shenanigans.

After reviewing some of the mongo package code, it seems awfully complex to implement, sadly.

For a hobby project that did 10 db inserts a second I employed queryable as a cache so I could batch insert to the actual remote mongodb instead of inserting 10 times a second. It worked really great for my use and should be a perfect fit for yours.

Just create a new package where you define it as a dependency and export the queryable = Npm.require(‘queryable’);
(or wait for meteor 1.3 and simply require it as an npm package :wink: )

https://www.npmjs.com/package/queryable

Also looks very good.

I need to look into on how to make this into a Meteor package that integrates with DDP to provide the mongo interaface, hope I said it clearly enough :slight_smile:

For integration, you can publish raw data within a meteor publication. You’d have to define a client-side collection and use the low-level added/changed/removed functions inside the publication.
So, you’d fetch the data from queryable, call the this.added() function on the data and this.ready() to finish the publication. You can find a decent example in the meteor docs under Meteor.publish.