store, retrieve, delete, and search org:Organizations using levelgraph-jsonld
var level = require('level');
var db = level('./mydb');
var orgs = require('orgs')(db, opts);
Storing organizations is extremely easy:
var wbcg = {
"@id": "https://web-payments.org#org",
"name": "Web Payments Community Group",
"homepage": "https://web-payments.org"
};
orgs.put(wbcg, function(err, obj) {
// do something after the obj is inserted
});
Retrieving a JSON-LD object from the store requires its '@id'
:
orgs.get(wbcg['@id'], function(err, obj) {
// obj will be the very same of the wbcg object
});
In order to delete an object, you can just pass it's '@id'
to the
'@del'
method:
orgs.del(wbcg['@id'], function(err) {
// do something after it is deleted!
});
TODO
MIT