Skip to content

Commit

Permalink
nodejscouchbase
Browse files Browse the repository at this point in the history
  • Loading branch information
yasinfmd committed Jun 7, 2024
1 parent 6223556 commit 3f0c96e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
32 changes: 32 additions & 0 deletions node couchbase/app.js
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()
15 changes: 15 additions & 0 deletions node couchbase/package.json
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"
}
}

0 comments on commit 3f0c96e

Please sign in to comment.