Closed despiegk closed 5 years ago
branch: development_jumpscale commit: de84017b2cfdfe0479c336a298cd386d79ee883a
branch: development_webdb commit: https://github.com/threefoldtech/digitalmeX/commit/4b65a9b1960d349fada260b2e3428f5ae42c9076
Following docs here
bcdb = j.data.bcdb.get(name="test")
bcdb.reset()
j.data.schema.add_from_text("""
@url = proj.os
name* = "" (S)
""")
j.data.schema.add_from_text("""
@url = proj.phone
model* = "" (S)
os* = "" !proj.os
""")
j.data.schema.add_from_text("""
@url = proj.human
name* = "" (S)
phone* = "" !proj.phone
""")
j.servers.gundb._server_test_start()
<html>
<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
<script>
var gun = Gun("ws://172.17.0.2:7766/gun")
gun.get("proj.human://1").put({"name":"xmon"})
gun.get("proj.human://1").get("phone").put({
"model":"samsung"
})
gun.get("proj.human://1").get("phone").get("os").put({
"name":"android"
})
gun.get("proj.human://2").put({"name":"richxmon"})
gun.get("proj.human://2").get("phone").put({
"model":"iphone"
})
gun.get("proj.human://2").get("phone").get("os").put({
"name":"ios"
})
</script>
</html>
JSX> bcdb.get_all()
## {BLUE}proj.human
{RESET}{GRAY}id: 1
{RESET}{RED}name : xmon
{RESET}favnums : []
langs : []
phone : {'model': 'samsung', 'os': {'name': 'android'}}
{RESET}
## {BLUE}proj.human
{RESET}{GRAY}id: 2
{RESET}{RED}name : richxmon
{RESET}favnums : []
langs : []
phone : {'model': 'iphone', 'os': {'name': 'ios'}}
{RESET}
[, ]
branch: development_webdb
make example how to work with gunjs in JSX towards BCDB use j.servers.gundb and make test gevent server there