loco-rs / loco

🚂 🦀 The one-person framework for Rust for side-projects and startups
https://loco.rs
Apache License 2.0
5.24k stars 221 forks source link

mongodb support #946

Closed gustawdaniel closed 3 days ago

gustawdaniel commented 3 days ago

Feature Request

Is your feature request related to a problem? Please describe.

Currently, the loco.rs framework lacks native support for MongoDB, which complicates integration with projects that rely on MongoDB as a database solution. I encounter an issue when attempting to implement MongoDB within loco.rs, as there's no built-in support or straightforward configuration available.

Describe the solution you'd like

I'd like loco.rs to include official MongoDB support, allowing seamless integration with MongoDB databases. This could be achieved by adding a database adapter or middleware that supports MongoDB operations (such as querying, inserting, updating, and deleting documents) and providing built-in configuration options for connection management.

Describe alternatives you've considered

As an alternative, I considered creating comprehensive documentation on how to manually connect to MongoDB within loco.rs using a Rust MongoDB driver. This would include guidelines for setting up a connection, performing CRUD operations, and handling connection management. However, this approach requires manual implementation and might lead to inconsistencies or complications for users.

NexVeridian commented 3 days ago

Seaorm and sqlx only has support for PostgreSQL, MySQL, and SQLite. You could ignore the models section and add database queries like normal Axum code.

jondot commented 3 days ago

Please look at the extras repo in the loco-rs org. there is an example of how to use MongoDB.

I don’t suppose we want to do MongoDB as a native DB. Currently we support what ever SeaORM support 👍🏻