Giter VIP home page Giter VIP logo

node-sequoiadb's Introduction

Node Sequoiadb

Node.js Driver for SequoiaDB

Installation

$ npm install sequoiadb --save

API

Connection

Create a connection to sequoiadb server:

var Connection = require('sequoiadb');
var conn = new Connection(11810, "ip", {
  user: "",
  pass: ""
});

Disconnect with sequoiadb server:

conn.disconnect([callback]);

Wait for connection ready:

conn.ready(function () {
  // TODO
});

All operation must be after db ready.

User

Create a user:

conn.createUser('user', 'pass', function (err) {
  // TODO
});

Remove a user:

conn.removeUser('user', 'pass', function (err) {
  // TODO
});

CollectionSpace

Create CollectionSpace in sequoiadb:

conn.createCollectionSpace("space_name", function (err, space) {
  // TODO
});

Get CollectionSpace in sequoiadb by name:

conn.getCollectionSpace("space_name", function (err, space) {
  // TODO
});

Check given space name whether exist:

conn.isCollectionSpaceExist("space_name", function (err, exist) {
  // TODO
});

Drop CollectionSpace:

conn.dropCollectionSpace("space_name", function (err) {
  // TODO
});

Get all CollectionSpaces:

conn.getCollectionSpaces(function (err, cursor) {
  // TODO
});

Cursor

Get current item:

cursor.current(function (err, item) {
  // TODO
});

Get next item:

cursor.next(function (err, item) {
  // TODO
});

Close cursor:

cursor.close(function (err) {
  // TODO
});

Collection

Create a Collection in CollectionSpace:

space.createCollection('collection_name', function (err, collection) {
  // TODO
});

Get a Collection from CollectionSpace by given name:

space.getCollection('collection_name', function (err, collection) {
  // TODO
});

Check a Collection whether exist:

space.isCollectionExist('collection_name', function (err, exist) {
  // TODO
});

Drop a Collection from a CollectionSpace:

space.dropCollection('collection_name', function (err) {
  // TODO
});

Document

Insert a document into Collection:

collection.insert({"name":"sequoiadb"}, function (err) {
  // TODO
});

Upsert a document into Collection:

collection.upsert({name: "sequoiadb"}, {'$set': {age: 26}}, {}, function (err) {
  // TODO
});

Bulk insert documents into Collection:

var insertors = [
  {name: "hi"},
  {name: "jack"}
];
collection.bulkInsert(insertors, 0, function (err) {
  // TODO
});

Query all document of Collection:

collection.query(function (err, cursor) {
  // TODO
});

Index

Create Index for collection:

var key = {
  "Last Name": 1,
  "First Name": 1
};
collection.createIndex("index_name", key, false, false, function (err) {
  // TODO
});

Get index with given name:

collection.getIndex("index_name", function (err, cursor) {
  // TODO
});

Get all indexes:

collection.getIndex(function (err, cursor) {
  // TODO
});

Or:

collection.getIndexes(function (err, cursor) {
  // TODO
});

Drop index:

collection.dropIndex('index_name', function (err) {
  // TODO
});

License

The Apache License 2.0

node-sequoiadb's People

Contributors

tynia avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.