{"library":"oracle-nosqldb","title":"Oracle NoSQL Database Node.js Driver","description":"The `oracle-nosqldb` package provides the Node.js SDK for interacting with Oracle NoSQL Database, supporting both the Oracle NoSQL Database Cloud Service and on-premise deployments. Currently at version 5.5.3, the library offers comprehensive interfaces for developing JavaScript and TypeScript applications, enabling operations like table creation, data insertion, retrieval, and schema management. While a strict release cadence isn't specified, it appears to follow major Node.js ecosystem updates and NoSQL database feature releases. A key differentiator is its dual support for cloud and and on-premise environments, offering a consistent API across deployment models. Developers need Node.js 12 or higher, and for TypeScript projects, TypeScript 5.0.x or higher is recommended.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install oracle-nosqldb"],"cli":null},"imports":["import { NoSQLClient } from 'oracle-nosqldb';","import { Region } from 'oracle-nosqldb';","import { ServiceType } from 'oracle-nosqldb';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"/*\n * A simple example that\n *   - creates a table\n *   - inserts a row using the put() operation\n *   - reads a row using the get() operation\n *   - drops the table\n *\n * To run:\n *  1. Edit for your target environment and credentials\n *  2. Run it:\n *       node quickstart.js cloud|cloudsim|kvstore\n *\n *  Use 'cloud' for the Oracle NoSQL Database Cloud Service\n *  Use 'cloudsim' for the Oracle NoSQL Cloud Simulator\n *  Use 'kvstore' for the Oracle NoSQL Database on-premise\n */\n'use strict';\n\nconst NoSQLClient = require('oracle-nosqldb').NoSQLClient;\nconst Region = require('oracle-nosqldb').Region;\nconst ServiceType = require('oracle-nosqldb').ServiceType;\n\n// --- Configuration (replace with your actual credentials and endpoint) ---\n// For Oracle NoSQL Database Cloud Service:\n// const config = {\n//   serviceType: ServiceType.CLOUD,\n//   region: Region.US_PHOENIX_1, // e.g., Region.US_PHOENIX_1\n//   auth: {\n//     userName: process.env.OCI_USER_OCID ?? '',\n//     tenantId: process.env.OCI_TENANT_OCID ?? '',\n//     privateKey: process.env.OCI_PRIVATE_KEY_PATH ?? '',\n//     fingerprint: process.env.OCI_FINGERPRINT ?? '',\n//     passPhrase: process.env.OCI_PRIVATE_KEY_PASSPHRASE ?? '' // Optional\n//   }\n// };\n\n// For Oracle NoSQL Cloud Simulator or On-Premise:\nconst config = {\n  serviceType: ServiceType.KVSTORE,\n  endpoint: process.env.NOSQL_ENDPOINT ?? 'localhost:8080' // Default for simulator/on-prem\n};\n\nasync function runQuickstart() {\n  let client;\n  try {\n    client = new NoSQLClient(config);\n    const tableName = 'quickstartTable';\n\n    console.log(`Creating table: ${tableName}`);\n    await client.tableDDL(`CREATE TABLE ${tableName} (id LONG, name STRING, PRIMARY KEY (id))`);\n    console.log('Table created.');\n\n    const row = { id: 1, name: 'Hello, Oracle NoSQL!' };\n    console.log(`Putting row: ${JSON.stringify(row)}`);\n    await client.put(tableName, row);\n    console.log('Row put.');\n\n    console.log(`Getting row with id: ${row.id}`);\n    const result = await client.get(tableName, { id: row.id });\n    console.log(`Got row: ${JSON.stringify(result.value)}`);\n\n    console.log(`Dropping table: ${tableName}`);\n    await client.tableDDL(`DROP TABLE ${tableName}`);\n    console.log('Table dropped.');\n\n  } catch (error) {\n    console.error('Error:', error.message);\n  } finally {\n    if (client) {\n      client.close();\n    }\n  }\n}\n\nrunQuickstart();","lang":"typescript","description":"This quickstart demonstrates creating a table, inserting a record using `put()`, retrieving it with `get()`, and finally dropping the table. It provides configuration placeholders for both Oracle NoSQL Database Cloud Service and on-premise/simulator environments.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}