helene icon indicating copy to clipboard operation
helene copied to clipboard

How to synchronise collections with your database?

Open ceigey opened this issue 1 year ago • 1 comments

Hi there,

I noticed the following comment in the docs:

This is not intended to be a replacement for MongoDB or a DBS, but rather a way to manage local data at the application level, which can then be synchronized with your database

I also noticed IStorage just has 3x methods (see bottom), NodeStorage is writing to files, and Persistance has methods that don't line up specifically with IStorage (different names - different intents?) but the collection APIs have a Mongo-style API.

The feeling I get is that the storage API is designed to be quite restrictive, but "synchronized with your database" might give developers the impression that the capabilities of the storage API are similar to that of a database driver, like for example Meteor Collections, ORMs, or the database abstractions in libraries like Lucia Auth.

I will also link unstorage here as a comparison point, as I think Helene's data module is doing something similar to this library, maybe there's some ideas that can be shared: https://github.com/unjs/unstorage

https://github.com/leonardoventurini/helene/blob/aebbf3535a05d85727b4365683165fce7818819c/src/data/types.ts#L1-L7

ceigey avatar Sep 26 '23 05:09 ceigey

My intent was to have something similar to "minimongo" to be used in the front-end (with React), I refactored nedb to use async/await and even managed to improve the code a little bit, making it work in browsers.

The API is also similar to an older version of mongo not the current one.

I will change the wording used for it.

I did not know about unstorage that can be a great alternative I think. A really good inspiration for sure.

leonardoventurini avatar Sep 26 '23 14:09 leonardoventurini