SuperAPI AI Directory

atscript-db-mongo

General & other

View repository

Updated 10-16 01:19

About this skill

@atscript/db-mongo

MongoDB metadata extension for Atscript. Defines annotations for collections, indexes, search, and patch strategies, plus runtime classes (AsCollection, AsMongo) with built-in validation, filtering, querying, and writing.

How to use this skill

Read the domain file that matches the task. Do not load all files — only what you need.

Domain File Load when...
Core setup & plugin config core.md Installing the plugin, configuring atscript.config, understanding the plugin architecture
Annotations reference annotations.md Writing .as files with database and MongoDB annotations, understanding annotation arguments
Collections & CRUD collections.md Using AsCollection/AsMongo for insert, replace, update, query, or sync indexes
Patch strategies patches.md Working with @db.mongo.patch.strategy, array patch operations ($insert/$upsert/$update/$remove/$replace)

Quick reference

@db.table 'users'
@db.mongo.collection
export interface User {
    @db.index.unique 'email_idx'
    email: string.email

    @db.mongo.index.text 5
    name: string

    @db.index.plain 'status_idx'
    isActive: boolean
}
import { AsMongo } from "@atscript/db-mongo";
import { User } from "./user.as";

const asMongo = new AsMongo("mongodb://localhost:27017/mydb");
const users = asMongo.getCollection(User);
await users.insert({ email: "a@b.com", name: "Alice", isActive: true });