Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
newghost committed Apr 6, 2020
1 parent b743330 commit 3646ce5
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions README.md
Expand Up @@ -4,11 +4,54 @@ OnceDB uses operators to dynamically define indexes. OnceDB do not changing the

# Document

http://oncedb.com
https://oncedb.com/wiki/view/oncedb-server

# Driver

Node.js: Comming soon...
Node.js:

You can use the following code to update and query the data:

```
const util = require('util')
const oncedb = require('oncedb')()
const update = util.promisify(oncedb.update).bind(oncedb)
const select = util.promisify(oncedb.select).bind(oncedb)
//Defining the schema
oncedb.schema('user', {
username : 'id'
, password : ''
, title : 'index'
, skills : 'keywords'
});
(async () => {
// update data
await upsert('user', { username: 'dota', password: '123456', title: 'SDEI', skills: 'java,go,c' })
// query data
let rows = await select('user', { skills: 'c' })
console.log('rows.count', rows.count)
console.log(rows)
})();
```
Result

```
rows.count 1
[
{
_key: 'user:dota',
skills: [ 'java', 'go', 'c' ],
username: 'dota',
password: '123456',
title: 'SDEI'
}
]
```


# Release
Expand Down

0 comments on commit 3646ce5

Please sign in to comment.