{"id":13454803,"url":"https://github.com/couchbase/couchnode","last_synced_at":"2025-10-07T15:19:17.818Z","repository":{"id":4246598,"uuid":"5371784","full_name":"couchbase/couchnode","owner":"couchbase","description":"Couchbase Node.js Client Library (Official)","archived":false,"fork":false,"pushed_at":"2025-02-24T17:11:27.000Z","size":14094,"stargazers_count":462,"open_issues_count":5,"forks_count":228,"subscribers_count":53,"default_branch":"master","last_synced_at":"2025-03-15T20:05:53.870Z","etag":null,"topics":["couchbase","nodejs","sdk"],"latest_commit_sha":null,"homepage":"https://www.couchbase.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/couchbase.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-08-10T16:42:53.000Z","updated_at":"2025-02-24T17:11:31.000Z","dependencies_parsed_at":"2024-01-06T10:21:36.853Z","dependency_job_id":"81a17ce8-7b19-4ca4-9fbf-436a96a72d14","html_url":"https://github.com/couchbase/couchnode","commit_stats":{"total_commits":1170,"total_committers":48,"mean_commits":24.375,"dds":0.3111111111111111,"last_synced_commit":"e8bdc086d2e66c942c3cdeb9b977a9d286cc0b98"},"previous_names":[],"tags_count":121,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcouchnode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcouchnode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcouchnode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/couchbase%2Fcouchnode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/couchbase","download_url":"https://codeload.github.com/couchbase/couchnode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245013991,"owners_count":20547181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["couchbase","nodejs","sdk"],"created_at":"2024-07-31T08:00:58.066Z","updated_at":"2025-10-07T15:19:12.776Z","avatar_url":"https://github.com/couchbase.png","language":"TypeScript","readme":"# Couchbase Node.js Client\n\nThe Node.js SDK library allows you to connect to a Couchbase cluster from\nNode.js. It is a native Node.js module and uses the very fast libcouchbase\nlibrary to handle communicating to the cluster over the Couchbase binary\nprotocol.\n\n## Useful Links\n\nSource - [https://github.com/couchbase/couchnode](https://github.com/couchbase/couchnode)\n\nBug Tracker - [https://jira.issues.couchbase.com/projects/JSCBC/issues/](https://jira.issues.couchbase.com/projects/JSCBC/issues/)\n\nCouchbase Developer Portal - [https://docs.couchbase.com/](https://docs.couchbase.com/nodejs-sdk/3.0/hello-world/start-using-sdk.html)\n\nRelease Notes - [https://docs.couchbase.com/nodejs-sdk/3.0/project-docs/sdk-release-notes.html](https://docs.couchbase.com/nodejs-sdk/3.0/project-docs/sdk-release-notes.html)\n\n## Installing\n\nTo install the lastest release using npm, run:\n\n```bash\nnpm install couchbase\n```\n\nTo install the development version directly from github, run:\n\n```bash\nnpm install \"git+https://github.com/couchbase/couchnode.git#master\"\n```\n\n## Introduction\n\nConnecting to a Couchbase bucket is as simple as creating a new `Cluster`\ninstance to represent the `Cluster` you are using, and then using the\n`bucket` and `collection` commands against this to open a connection to\nopen your specific bucket and collection. You are able to execute most\noperations immediately, and they will be queued until the connection is\nsuccessfully established.\n\nHere is a simple example of instantiating a connection, adding a new document\ninto the bucket and then retrieving its contents:\n\n**Javascript:**\n```javascript\nconst couchbase = require('couchbase')\n\nasync function main() {\n  const cluster = await couchbase.connect(\n    'couchbase://127.0.0.1',\n    {\n      username: 'username',\n      password: 'password',\n    })\n\n  const bucket = cluster.bucket('default')\n  const coll = bucket.defaultCollection()\n  await coll.upsert('testdoc', { foo: 'bar' })\n\n  const res = await coll.get('testdoc')\n  console.log(res.content)\n}\n\n// Run the main function\nmain()\n  .then((_) =\u003e {\n    console.log ('Success!')\n  })\n  .catch((err) =\u003e {\n    console.log('ERR:', err)\n  })\n```\n\n**Typescript:**\n```javascript\nimport {\n  Bucket,\n  Cluster,\n  Collection,\n  connect,\n  GetResult,\n} from 'couchbase'\n\nasync function main() {\n  const cluster: Cluster = await connect(\n    'couchbase://127.0.0.1',\n    {\n      username: 'username',\n      password: 'password',\n    })\n\n  const bucket: Bucket = cluster.bucket('default')\n  const coll: Collection = bucket.defaultCollection()\n  await coll.upsert('testdoc', { foo: 'bar' })\n\n  const res: GetResult = await coll.get('testdoc')\n  console.log(res.content)\n}\n\n// Run the main function\nmain()\n  .then((_) =\u003e {\n    console.log ('Success!')\n  })\n  .catch((err) =\u003e {\n    console.log('ERR:', err)\n  })\n```\n\n## AWS Lambda\n\nVersion 4.2.5 of the SDK significantly reduces the size of the prebuilt binary provided with the SDK on supported platforms. The reduction\nenables the SDK to meet the [minimum size requirements](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html) for an AWS lambda deployment package without extra steps for reducing the size of the package.  However, if further size reduction is desired, the SDK provides a script to provide recommendations for size reduction.\n\n**Script:**\n```bash\nnpm explore couchbase -- npm run help-prune\n```\n\n**Example output:**\n```bash\nChecking for platform packages in /tmp/couchnode-test/node_modules/@couchbase that do not match the expected platform package (couchbase-linux-x64-openssl1).\nFound mismatch: Path=/tmp/couchnode-test/node_modules/@couchbase/couchbase-linuxmusl-x64-openssl1\n\nRecommendations for pruning:\n\nRemoving mismatched platform=couchbase-linuxmusl-x64-openssl1 (path=/tmp/couchnode-test/node_modules/@couchbase/couchbase-linuxmusl-x64-openssl1) saves ~13.31 MB on disk.\nRemoving Couchbase deps/ (path=/tmp/couchnode-test/node_modules/couchbase/deps) saves ~45.51 MB on disk.\nRemoving Couchbase src/ (path=/tmp/couchnode-test/node_modules/couchbase/src) saves ~0.61 MB on disk.\n```\n\n## Documentation\n\nAn extensive documentation is available on the Couchbase website - [https://docs.couchbase.com/nodejs-sdk/3.0/hello-world/start-using-sdk.html](https://docs.couchbase.com/nodejs-sdk/3.0/hello-world/start-using-sdk.html) -\nincluding numerous examples and code samples.\n\nVisit our [Couchbase Node.js SDK forum](https://forums.couchbase.com/c/node-js-sdk) for help.\nOr get involved in the [Couchbase Community](https://couchbase.com/community) on the [Couchbase](https://couchbase.com) website.\n\n## Source Control\n\nThe source code is available at\n[https://github.com/couchbase/couchnode](https://github.com/couchbase/couchnode).\nOnce you have cloned the repository, you may contribute changes through our\ngerrit server. For more details see\n[CONTRIBUTING.md](https://github.com/couchbase/couchnode/blob/master/CONTRIBUTING.md).\n\nTo build the client, follow the steps outlined on the [BUILDING page](https://github.com/couchbase/couchnode/blob/main/BUILDING.md)\n\nTo execute our test suite, run `make test` from the root directory.\n\nTo execute our code coverage, run `make cover` from the root directory.\n\nIn addition to the full test suite and full code coverage, you may additionally\nexecute a subset of the tests which excludes slow-running tests for quick\nverifications. These can be run through `make fasttest` and `make fastcover`\nrespectively.\n\nFinally, to build the API reference for the project, run `make docs` from the\nroot directory, and a docs folder will be created with the api reference.\n\n# Support \u0026 Additional Resources\n\nIf you found an issue, please file it in our [Github issues](https://github.com/couchbase/couchnode/issues).  We will bring over the issue to our [JIRA](https://jira.issues.couchbase.com/projects/JSCBC/issues/) as needed.\n\nThe Couchbase Discord server is a place where you can collaborate about all things Couchbase. Connect with others from the community, learn tips and tricks, and ask questions. [Join Discord and contribute](https://discord.com/invite/sQ5qbPZuTh).\n\nYou can ask questions in our [forums](https://forums.couchbase.com/).\n\n## License\n\nCopyright 2013 Couchbase Inc.\n\nLicensed under the Apache License, Version 2.0.\n\nSee\n[LICENSE](https://github.com/couchbase/couchnode/blob/master/LICENSE)\nfor further details.\n","funding_links":[],"categories":["Packages","Repository","包","TypeScript","Database","目录"],"sub_categories":["Database","数据库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase%2Fcouchnode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcouchbase%2Fcouchnode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcouchbase%2Fcouchnode/lists"}