Gun: Database Features

Created on 14 Mar 2017  路  10Comments  路  Source: amark/gun

Gun is amazing but database features such as role base security, Schema, Indexing, Sorting, Searching/Query, Pagination, data aggregation are must for any production ready database. Is there any plan to implement these features in near future?

Most helpful comment

@ansarizafar I know, and gun is completely Open Source and gets better when contributors help - I provided a bunch of links to help you get started with some of these ideas (have you read through all of them?), if those are not satisfactory we'd love to work with you to have you create your ideal tutorial which will benefit everybody else. We'll help you learn in more details the necessary thing to build what you want and in turn your contribution will be the perfect tutorial for everybody else. :D :D

Just FYI, we already have some governments rolling out some production use cases with gun. Many of the things you want to do can be done with gun, but it will require learning and building and helping out the community. :)

All 10 comments

@ansarizafar yes. Here is some more information:

How to approach security with gun: http://gun.js.org/explainers/data/security.html

Schema validation can be used with any existing system, AJV seems to be the fastest: https://github.com/epoberezkin/ajv , but https://github.com/mafintosh/is-my-json-valid is also popular. If you want a more "seamless" integration with gun, you can build an extension called Gun.chain.save = function(){} where you validate first before calling gun.put or if you need further help (or want to see other examples of validation) hit us up on https://gitter.im/amark/gun .

Indexing is already built in with gun.get('myIndex').put({hello: 'world'})

Sorting can be done like so: http://gun.js.org/explainers/basketball/basketball.html

Searching/Query is already done with gun's API, where you can map over tables and search for data. Somebody is already working on a SQL query extension built on top. It is possible to build your own custom query language on top of gun, too!

Pagination, while gun is already optimizes requests (it only loads the data you ask for), it is true that you might want to paginate table maps - the design for this is in the wire spec but not yet implemented anywhere. So that will come in the future.

Does this help?

A comprehensive tutorial/example showing all these database features including data aggregation/ACID Transactions would greatly help developers new to Gun. Please also share SQL query project link.

@ansarizafar help me understand your needs - what are you trying to build? Doing this for a side project, full time project? Etc. And I'll see if I can get you something.

I am working on a subscriptions based office supplies marketplace (Restock) as a full-time project. I am currently using MongoDB but I want to replace it with a better database. MongoDB is simple but has limited relationships support, no ACID transactions and inefficient aggregation framework. I am currently considering ArangoDB but I found Gun. If GUN can provide mentioned features then I will definitely switch my database. A production ready database should be simple but must provide these features.

Would you like to help contribute to the Open Source project and work on writing a comprehensive tutorial/example?

Existing tutorials, documentations, examples, and explainers are available on the homepage: gun.js.org (have you seen these yet?) would you like to help out adding more?

I am new to Gun, I am looking for help myself. It seems that Gun will not provide above mentioned features in near future. These features are must for a production ready database.

@ansarizafar I know, and gun is completely Open Source and gets better when contributors help - I provided a bunch of links to help you get started with some of these ideas (have you read through all of them?), if those are not satisfactory we'd love to work with you to have you create your ideal tutorial which will benefit everybody else. We'll help you learn in more details the necessary thing to build what you want and in turn your contribution will be the perfect tutorial for everybody else. :D :D

Just FYI, we already have some governments rolling out some production use cases with gun. Many of the things you want to do can be done with gun, but it will require learning and building and helping out the community. :)

Interesting discussion.
Sorting/aggregating etc isn't something im concerned with.
There's a MYRIAD of ways to do that by throwing in some npm modules (lodash, mongo-query, ajv etc).
And yes, when you do so, just release a gun.js plugin or something.

What Im particularly interesting in, is a hybrid setup of an api-database, and using gun.js for broadcasting public info (instead of using websockets on the api-database).
Anyone did this already?

@coderofsalvation you'd have to explain what you mean by api-database?

I've used gun to do request-response cycles (API like), where on the server I do gun.get('reqs').map().val(cb) and on the client I do gun.get('reqs').set({my: 'request'}).get('ack').val(cb) then on the server in the cb which fires I process data and then reply by doing this.get('ack').put({my: 'reply'}) which now shows up in the client's val.

It is really cool actually, (however it needs to be "in-memory" mode or else when the server reboots it replies to old requests, because they got saved to storage - so "in-memory" only helps) and I hope somebody expands this into a full fledged framework for data aggregation, processing, transactions, etc. I could see it being very useful for multi-page shopping cart order forms or similar.

Note: I'm trying to encourage people to not use GitHub issues for discussions - the https://gitter.im/amark/gun is more appropriate (or even StackOverflow), because I want to keep GitHub Issues to actual bugs. So request that would be helpful to me: can you guys help me move this discussion somewhere else so we can close any non-bug or non-current-documentation-problems? There is also this issue list dedicated to feature requests: https://github.com/gundb/feature-requests/issues . Thanks!

lets continue this on the https://gitter.im/amark/gun , the community there is fantastic and very engaging, so the more we can get discussions like this on there the more say/impact people can have on the project. (I'd rather involve more people, that have different views than mine, on the chat than the very few people that interact in these issue sections)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ronsku picture Ronsku  路  4Comments

linonetwo picture linonetwo  路  4Comments

ctrlplusb picture ctrlplusb  路  6Comments

Sarajin picture Sarajin  路  6Comments

ivkan picture ivkan  路  6Comments