Skip to content

Conversation

@0xvasanth
Copy link

Implements a full-featured MongoDB driver for Toasty ORM with support for:

  • All 8 core operations (Insert, GetByKey, UpdateByKey, DeleteByKey, QueryPk, FindPkByIndex, QuerySql, Transaction)
  • Automatic index creation from schema definitions
  • BSON type conversion system for all Toasty types
  • Primary key mapping to MongoDB _id field
  • Batch operations (insert_many, update_many, delete_many)
  • Efficient projections and streaming results
  • Standard mongodb:// connection string support

The driver follows established Toasty driver patterns and integrates seamlessly with the workspace through the mongodb feature flag.

Transaction support is structured but requires session management implementation for full ACID transactions (requires MongoDB replica sets).

Files created:

  • crates/toasty-driver-mongodb/ (complete driver implementation)
  • examples/mongodb-example/ (example application)

Modified:

  • Cargo.toml (added driver to workspace)
  • crates/toasty-core/src/driver/capability.rs (MongoDB capabilities)
  • crates/toasty/Cargo.toml (mongodb feature flag)
  • crates/toasty/src/driver.rs (connection routing)

Implements a full-featured MongoDB driver for Toasty ORM with support for:

- All 8 core operations (Insert, GetByKey, UpdateByKey, DeleteByKey, QueryPk, FindPkByIndex, QuerySql, Transaction)
- Automatic index creation from schema definitions
- BSON type conversion system for all Toasty types
- Primary key mapping to MongoDB _id field
- Batch operations (insert_many, update_many, delete_many)
- Efficient projections and streaming results
- Standard mongodb:// connection string support

The driver follows established Toasty driver patterns and integrates seamlessly with the workspace through the mongodb feature flag.

Transaction support is structured but requires session management implementation for full ACID transactions (requires MongoDB replica sets).

Files created:
- crates/toasty-driver-mongodb/ (complete driver implementation)
- examples/mongodb-example/ (example application)

Modified:
- Cargo.toml (added driver to workspace)
- crates/toasty-core/src/driver/capability.rs (MongoDB capabilities)
- crates/toasty/Cargo.toml (mongodb feature flag)
- crates/toasty/src/driver.rs (connection routing)
@0xvasanth 0xvasanth marked this pull request as draft November 21, 2025 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant