I found this question about SQL-like query libraries. What I am looking for is a library that allows queries on JSON objects, embedded in a client-side application (browser), as well as from a remote high performance dedicated database.
For the sake of completeness I'll throw out PouchDB and CouchDB.
Pouch for client side: http://pouchdb.com/ Couch for server side: http://couchdb.apache.org/
I was searching for the same thing and after much searching suddenly came across NeDB, which now has a browser implementation.
https://github.com/louischatriot/nedb
Unlike PouchDB it has a Mongo-like query API.
var db = new Nedb()
. (note that it can load and save files with ajax) –
Eckhardt You could try couchbase lite (client side) that syncs with couchbase server.
http://www.couchbase.com/communities/couchbase-lite and http://www.couchbase.com/
It is a document based nosql database, querying isn't as rich as SQL but you have the ability to create additional indices on which to query your data by using couchbase views (map reduce jobs). These work both on the client and server, it also supports syncing between the device and server.
(yes i'm late for the party)
There's also a good alternative today: https://github.com/typicode/lowdb. It uses lodash and a UMD build is available on unpkg for testing and quick prototyping:
<script src="https://unpkg.com/lodash@4/lodash.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/low.min.js"></script>
<script src="https://unpkg.com/[email protected]/dist/LocalStorage.min.js"></script>
<script>
var adapter = new LocalStorage('db')
var db = low(adapter)
</script>
Then, just use it like this:
// Add a post
db.get('posts')
.push({ id: 1, title: 'lowdb is awesome'})
.write()
db.get('posts')
.find({ id: 1 })
.value()
Check the different adapters available
if you want to use SQL-query you could try N1QL. This extension to Couchbase allows you to query the system very similar to SQL-query. Also you should look at ElasticSearch. This is a very powerful search engine, but query language not SQL. Couchbase and ElasticSearch very well interact with each other via the plugin. Also OrientDB allows to do query on language very similar to SQL. I think it is possible to adapt OrientDB to json format. And of course there are MongoDB.
© 2022 - 2024 — McMap. All rights reserved.