couchbaselabs / node-ottoman

Node.js ODM for Couchbase
https://ottomanjs.com/
Apache License 2.0
287 stars 98 forks source link
couchbase nodejs nosql-database typescript

CI codecov npm version Commitizen friendly License semantic-release

Introduction

Ottoman is an ODM built for Couchbase and Node.js.

Ottoman's goal is to provide a better development experience while using Couchbase, bringing to developers a reliable tool to build systems that are easy to design, maintain, and scale.

Installation

npm install ottoman

That's it, you are ready to use Ottoman.

Dependencies Matrix

Supported version are:

Ottoman Nodejs Couchbase SDK Couchbase Server
^2.0.0 ^12.0.0 ^4.2.0 ^7.2.0

Notice: make sure you are using supported versions

Getting started

const { connect, model, start, close } = require('ottoman');

const main = async () => {
  await connect("couchbase://localhost/travel-sample@admin:password");

  const User = model('User', { name: String });

  const user = new User({ name: 'Jane Doe' });

  await start();

  await user.save();
  console.log('Nice Job!');

  await close();
}

main();

You should see results similar to the following:

Nice Job!

::: tip Note If you are using the legacy version of Ottoman, check out the V1 docs. :::

Ottoman v2 main goals

Documentation

Check out our examples and docs for typescript and javascript implementation.

Questions

For questions and support please use the official forum or contact community. Please make sure to read the Issue Reporting Checklist before opening an issue.

Changelog

Detailed changes for each release are documented in the release notes.

Stay In Touch

Contributions

Thank you to all the people who already contributed to Couchbase Ottoman!

Guide for Developers

  1. Install Couchbase Server Using Docker.

::: tip Note Check results on http://localhost:8091/ couchbase web client. :::

  1. Get the repo and install dependencies
$ git clone https://github.com/couchbaselabs/node-ottoman.git
$ cd node-ottoman
$ yarn install
  1. Available scripts
$ yarn dev
$ yarn build
$ yarn lint
$ yarn test
$ yarn test --coverage
$ yarn docs
$ yarn docs:dev

Deploying Ottoman to NPM

Publishing to NPM

When publishing a new package to NPM, please follow the following steps:

Once package is published, *update the docs:

License

© Copyright 2021 Couchbase Inc.

Licensed under the Apache License, Version 2.0. See the Apache 2.0 license.