Skip to content

Add NoSQLExtractor for raw MongoDB driver usage #76

Description

@itsflaid

Context
The EXTRACTORS chain in extractors/index.ts currently covers two schema sources: PrismaExtractor (full field/relation data) and SQLExtractor (raw pg/mysql2/better-sqlite3 clients → table names as pseudo-entities, no field data). Projects using the native mongodb driver without an ODM have no coverage and fall through to the low-confidence route-hint fallback.

Scope
New NoSQLExtractor implements IEntityExtractor, same pattern as SQLExtractor:

  • canHandle(): detect mongodb import (content-based, same regex approach as usesRawSqlClient)
  • extract(): scan .collection("name") / .collection('name') calls via ts-morph AST string literals (not regex-only — same rationale as SQLExtractor's comment on quote-pairing failure modes)
  • Output: pseudo-entities, fields: [], relations: [], source: "nosql" — NoSQL has no schema metadata to read the way Prisma does
    Acceptance criteria
  • Detects raw mongodb driver usage only (Mongoose is a separate extractor, see Render AI markdown cleanly in the terminal #4)
  • Registered in EXTRACTORS, after the ORM extractors, alongside/after SQLExtractor
  • EntityInfo["source"] / EntityGraph["source"] union types in types.ts extended with "nosql"
  • Tests added mirroring entity-extractors.test.ts coverage for SQLExtractor

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions