Skip to content

Developer Documentation

This section contains detailed documentation for developers contributing to or working with the GAS DB project.

⚠️ HEALTH WARNING ⚠️

These documents have been created by various LLMs and I've only given them a cursory skim for accuracy so they may not be fully updated.

Important step to avoid weird issues

Make sure you've enabled the DriveAPI in your Google Cloud project. This is crucial for the JsonDbApp to function correctly, especially for features like MasterIndex and file watching.

Core Documentation

Public API (for Apps Script consumers)

Use the top-level library functions instead of constructing classes directly:

  • JsonDbApp.createAndInitialiseDatabase(config) – first-time setup
  • JsonDbApp.loadDatabase(config) – load existing DB

Within this repo (old_tests/), you can still use new Database(config) then call createDatabase()/initialise() explicitly.

  • Collection Components - Detailed explanation of Collection, CollectionMetadata, and DocumentOperations classes for MongoDB-compatible document operations
  • Database - Main database class for collection management and coordination with MasterIndex
  • DatabaseConfig - Database configuration management with validation and defaults
  • Infrastructure Components - Complete reference for logging, error handling, and ID generation utilities
  • MasterIndex - Cross-instance coordination system using ScriptProperties for virtual locking and conflict detection
  • QueryEngine - Engine for parsing and executing MongoDB-style queries
  • Testing Framework - Comprehensive guide to the GAS DB testing infrastructure, including AssertionUtilities and TestRunner classes
  • UpdateEngine - Engine for applying MongoDB-style update operators to documents

Coding Standards

  • Linting: no-magic-numbers is enforced as an error for source files to keep configuration and algorithmic values explicit. Tests allow numeric literals for readability because the rule is disabled for tests/**/*.js.
  • Documentation: JSDoc completeness is enforced as errors; ensure descriptions, param types, and return details are present.