-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const couchbase=require('couchbase') | ||
|
||
async function main(){ | ||
const cluster=await couchbase.connect("couchbase://127.0.0.1",{ | ||
username:'root', | ||
password:'rootroot' | ||
}) | ||
const bucket=cluster.bucket("mydatas") | ||
const collection=bucket.defaultCollection() | ||
const user1={ | ||
name:"qwewqe", | ||
surname:"phrtkklrtj" | ||
} | ||
const user2={ | ||
name:"qwewqe2222", | ||
surname:"phrtkklrtj2223232" | ||
} | ||
// await collection.upsert(Math.random().toString(36),user1) | ||
// await collection.upsert(Math.random().toString(36),user2) | ||
|
||
const query = `SELECT META().id, * FROM mydatas`; | ||
const queryResult = await cluster.query(query); | ||
queryResult.rows.forEach((item)=>{ | ||
console.log(item) | ||
}) | ||
// await collection.get("0.sd2ykhpb3zr") | ||
//await collection.remove("0.sd2ykhpb3zr") | ||
// await collection.replace("111",{}) | ||
|
||
} | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "nodecouch", | ||
"version": "1.0.0", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"description": "", | ||
"dependencies": { | ||
"couchbase": "^4.3.1" | ||
} | ||
} |