Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript ORM Library

I am currently working on an application that stores all the data locally on the device, and updates it whenever there is a change.

Therefore, I am looking for a way to store, read and update objects with relations between them inside client-side javascript code easily.

I know I can use localStorage, WebSQL, IndexedDB or plain Javascript Object, but I am looking for ORM or something that will simplify the actions and handle the relations for me.

I am aware of the JayData library but looking for better alternatives.

like image 490
Aviran Cohen Avatar asked Sep 03 '26 06:09

Aviran Cohen


2 Answers

If you need a Database in your Browser maybe PuchDB is what you need.

You can find the API-documentation here: http://pouchdb.com/api.html. Everything can be stored at localStorage of the clients WebBrowser.

Example:

var db = new PouchDB('dbname');

// save some data
db.put({
  _id: 'mydoc',
  title: 'Heroes'
}, function(err, response) { });

// get som
db.get('mydoc', function(err, doc) { }); 

I hope this was helpfull :-)

like image 153
dreampulse Avatar answered Sep 05 '26 19:09

dreampulse


Have you checkout my own library, ydn-db. It does not handle relationship, but otherwise very good non-relational ORM ;-).

like image 27
Kyaw Tun Avatar answered Sep 05 '26 20:09

Kyaw Tun