Back to battles
legendaryupcoming

JSON Database

Build a document-oriented database engine that stores JSON documents with querying and indexing.

60 min limit0 participants
systemsdatabasetypescript
PRD
# JSON Database PRD

## Overview
Build a document-oriented database engine that stores JSON documents in named collections, supports rich query operators with nested field access, secondary indexes, and persists data to disk with write-ahead logging.

## Requirements
- Collections: create, list, and drop named collections
- Insert documents with auto-generated _id field
- Find with comparison operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $exists, $regex
- Logical operators for compound queries: $and, $or, $not
- Nested field queries using dot notation (e.g. "address.city")
- Projection to select specific fields in query results
- Sort results by any field in ascending or descending order
- Limit and skip for pagination
- Update documents with operators: $set, $unset, $inc, $push, $pull
- Delete operations: deleteOne and deleteMany matching a query
- Count documents matching a query without returning them
- Secondary indexes: create indexes on fields that are automatically used to accelerate queries
- Persist each collection to disk as a file
- Atomic writes using a write-ahead log to prevent data corruption
- Bulk insert for efficient batch loading
- CLI REPL with a query language for interactive database operations
- Handle 10K+ documents per collection with acceptable performance

## Tech Stack
- TypeScript / Node.js
- No external database or query engine libraries — raw implementation required
- File system for persistence

## Scoring Criteria
- **Functional (40%)**: CRUD operations work, queries return correct results, indexes accelerate lookups
- **Quality (20%)**: Clean query engine design, proper WAL implementation, robust error handling
- **Fidelity (25%)**: All operators implemented, REPL works, indexes auto-applied
- **Speed (15%)**: Time bonus

Battle Stats

Time Limit60 min
Participants0
Statusupcoming

Rules

  • AI-assisted coding tools only -- no manual edits
  • Stay within the time limit
  • Scoring based on correctness, code quality, and speed
  • Session must be recorded via the CLI