Product Documentation

c-treeDB API for Node.js

Previous Topic

Next Topic

Introduction to c-treeDB for Node.js

The FairCom navigational (NAV) module for Node.js (ctdbsdk.js) enables JavaScript developers to communicate with the FairCom Database Engine using methods similar to those exposed by the c-treeDB API.

This module is written in pure JavaScript. It has a dependency on the FairCom DB client library (mtclient). It also has dependencies on the foreign function interface (FFI) and the ref packages, which are easily available via the node package manager (npm).

Although this Node.js module has no specific Python requirement, the Node.js native build system, node-gyp, may need to be properly configured, as explained in https://github.com/nodejs/node-gyp.

The FairCom navigational module for Node.js is a wrapper on top of the c-treeDB API. You can refer to the c-treeDB online documentation for more information about this navigational interface.

In addition to this non-relational, navigational, Node.js module, FairCom also provides a fully relational module: Node.js SQL Module

The c-treeDB API makes it easy to navigate and process data very quickly across multiple databases no matter where they are located. Its unique ability is to simultaneously open cursors into multiple databases and remote control them. Applications use cursors to control every detail of record lookup and traversal. There are multiple types of cursors: index, table, filtered, range, metadata, batch query, batch insert, batch update, and batch delete. Each is optimized to make different use cases easy and fast. For example, your application can retrieve a record from one database and use its data to quickly position a cursor in another database to batch retrieve additional records.

Because the FairCom Database Engine is optimized specifically for cursors, applications can easily do very complex data processing tasks at high speed. Developers are not limited to using built-in SQL or GQL algorithms. A software developer can easily implement algorithms to traverse data as hierarchies, graphs, objects, tables, etc. A data engineer or data scientist can implement unique algorithms for machine learning, graph analytics, knowledge graphs, big data, etc. A back-end programmer can implement optimized algorithms for real-time transaction processing, high-velocity inserts, specialized microservices, etc.

While navigating records, a developer can do anything with the data, such as insert, update, and delete records. c-treeDB can find, retrieve, and process field values. Field values can be any common data type: JSON, custom binary structures, arrays, strings, numbers of all types, dates, times, monetary values, Boolean, etc. The database can automatically index fields containing these data types.

c-treeDB works simultaneously with SQL. Applications can use SQL and c-treeDB at the same time on the same data. SQL tools can simultaneously work with the same data as an application using c-treeDB.

SQL is ideal for writing queries that join data. c-treeDB is ideal for navigating complex data, such as walking hierarchies and graphs or implementing custom data processing algorithms. c-treeDB is easier than SQL because there is very little to learn and it is 100% predictable.

c-treeDB makes it easy to process complex data because developers can leverage the full power of their development language to break down complexity into manageable code. c-treeDB extends a developer's favorite development language directly into the database. In other words, a programmer can use their favorite programming language to remote control the database and directly process data. c-treeDB eliminates the need to learn a proprietary database language; instead, a developer’s favorite language becomes the database language.

c-treeDB is ideal for achieving extreme, predictable performance because it gives developers complete control over:

  • Navigating records in any order
    • Index- or table-order
    • Forward or backward
    • Filtered
    • Ranged
    • Partial-key
    • Bulk processed
    • Etc.
  • Saving record positions
  • Jumping back to saved positions
  • Controlling if and how each record is locked
  • Managing which records participate in transactions
  • Using custom algorithms to join data across tables
  • etc.

In addition to this highly efficient navigational Node.js module, FairCom also provides a traditional relational Node.js module: Node.js SQL Module

TOCIndex