All Projects → thedodd → Wither

thedodd / Wither

Licence: other
An ODM for MongoDB built on the official MongoDB Rust driver.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Wither

Mongoengine
MongoEngine is a Python Object-Document Mapper for working with MongoDB. Documentation is available at https://mongoengine-odm.readthedocs.io - there is currently a tutorial, a user guide, and an API reference.
Stars: ✭ 3,632 (+1987.36%)
Mutual labels:  orm, odm, mongodb
Odmantic
Async ODM (Object Document Mapper) for MongoDB based on python type hints
Stars: ✭ 240 (+37.93%)
Mutual labels:  orm, odm, mongodb
Qxorm
QxOrm library - C++ Qt ORM (Object Relational Mapping) and ODM (Object Document Mapper) library - Official repository
Stars: ✭ 176 (+1.15%)
Mutual labels:  orm, odm, mongodb
Mongo Thingy
🍃 The most idiomatic and friendly-yet-powerful way to use MongoDB with Python
Stars: ✭ 49 (-71.84%)
Mutual labels:  orm, odm, mongodb
Mongorito
🍹 MongoDB ODM for Node.js apps based on Redux
Stars: ✭ 1,409 (+709.77%)
Mutual labels:  odm, mongodb
Orango
ArangoDB Object Modeling for Node.js, Foxx and Modern Web Browsers
Stars: ✭ 103 (-40.8%)
Mutual labels:  orm, odm
Sqlalchemy Imageattach
SQLAlchemy extension for attaching images to entities.
Stars: ✭ 107 (-38.51%)
Mutual labels:  orm, databases
Awesome Python Models
A curated list of awesome Python libraries, which implement models, schemas, serializers/deserializers, ODM's/ORM's, Active Records or similar patterns.
Stars: ✭ 124 (-28.74%)
Mutual labels:  orm, odm
Avocado
Strongly-typed MongoDB driver for Rust
Stars: ✭ 70 (-59.77%)
Mutual labels:  mongodb, databases
Dtcqueuebundle
Symfony2/3/4/5 Queue Bundle (for background jobs) supporting Mongo (Doctrine ODM), Mysql (and any Doctrine ORM), RabbitMQ, Beanstalkd, Redis, and ... {write your own}
Stars: ✭ 115 (-33.91%)
Mutual labels:  orm, mongodb
Js Data
Give your data the treatment it deserves with a framework-agnostic, datastore-agnostic JavaScript ORM built for ease of use and peace of mind. Works in Node.js and in the Browser. Main Site: http://js-data.io, API Reference Docs: http://api.js-data.io/js-data
Stars: ✭ 1,599 (+818.97%)
Mutual labels:  orm, odm
F3 Cortex
A multi-engine ORM / ODM for the PHP Fat-Free Framework
Stars: ✭ 101 (-41.95%)
Mutual labels:  orm, mongodb
Typegoose
Typegoose - Define Mongoose models using TypeScript classes.
Stars: ✭ 1,232 (+608.05%)
Mutual labels:  odm, mongodb
Ymate Platform V2
YMP是一个非常简单、易用的轻量级Java应用开发框架,涵盖AOP、IoC、WebMVC、ORM、Validation、Plugin、Serv、Cache等特性,让开发工作像搭积木一样轻松!
Stars: ✭ 106 (-39.08%)
Mutual labels:  orm, mongodb
Typegoose
Typegoose - Define Mongoose models using TypeScript classes.
Stars: ✭ 1,189 (+583.33%)
Mutual labels:  odm, mongodb
Mongoframework
An "Entity Framework"-like interface for MongoDB
Stars: ✭ 116 (-33.33%)
Mutual labels:  orm, mongodb
Nosqlmap
Automated NoSQL database enumeration and web application exploitation tool.
Stars: ✭ 1,928 (+1008.05%)
Mutual labels:  mongodb, databases
Dynamo Easy
DynamoDB client for NodeJS and browser with a fluent api to build requests. We take care of the type mapping between JS and DynamoDB, customizable trough typescript decorators.
Stars: ✭ 133 (-23.56%)
Mutual labels:  orm, odm
Framework
Strongly-typed JavaScript object with support for validation and error handling.
Stars: ✭ 136 (-21.84%)
Mutual labels:  orm, odm
Phalcon Mongodb Odm
MongoDB ODM for Phalcon framework for new mongodb php extension with query builder and rich functionality
Stars: ✭ 42 (-75.86%)
Mutual labels:  odm, mongodb

wither

An ODM for MongoDB built on the official MongoDB Rust driver. Please ⭐ on github!

Build Status Crates.io docs.rs License Crates.io

The primary goal of this project is to provide a simple, sane & predictable interface into MongoDB based on data models. If at any point this system might get in your way, you have direct access to the underlying driver. This project is tested against MongoDB 3.6, 4.0, 4.2 & 4.4.

GREAT NEWS! Wither is now based on the official MongoDB Rust driver. Thanks to advancements in the driver, Wither is now fully asynchronous. Simply mirroring the features of the underlying MongoDB driver, Wither supports the following runtimes:

Due to updates in the underlying driver, there is a fair number of breaking changes in the Model trait, as well as the Model derive macro. Details can be found in the changelog and the documentation. Furthermore, everything is now async by default, and the synchronous interface has been completely removed from the repo.

items of interest

getting started

To get started, simply derive Model on your struct along with a few other serde derivations. Let's step through a full example.

use futures::stream::StreamExt;
use serde::{Serialize, Deserialize};
use wither::{prelude::*, Result};
use wither::bson::{doc, oid::ObjectId};
use wither::mongodb::Client;

// Define a model. Simple as deriving a few traits.
#[derive(Debug, Model, Serialize, Deserialize)]
#[model(index(keys=r#"doc!{"email": 1}"#, options=r#"doc!{"unique": true}"#))]
struct User {
    /// The ID of the model.
    #[serde(rename="_id", skip_serializing_if="Option::is_none")]
    pub id: Option<ObjectId>,
    /// The user's email address.
    pub email: String,
}

#[tokio::main]
async fn main() -> Result<()> {
    // Connect & sync indexes.
    let db = Client::with_uri_str("mongodb://localhost:27017/").await?.database("mydb");
    User::sync(&db).await?;

    // Create a user.
    let mut me = User{id: None, email: String::from("[email protected]")};
    me.save(&db, None).await?;

    // Update user's email address.
    me.update(&db, None, doc!{"$set": doc!{"email": "[email protected]"}}, None).await?;

    // Fetch all users.
    let mut cursor = User::find(&db, None, None).await?;
    while let Some(user) = cursor.next().await {
        println!("{:?}", user);
    }
    Ok(())
}

next steps

And that's all there is to it. Now you are ready to tackle some of the other important parts of the model lifecycle. Some additional items to look into:

  • deriving model - learn more about automatically deriving the Model trait on your structs.
  • model usage - check out some of the other methods available to you from your models.
  • syncing indexes - learn how to synchronize a model's indexes with the database.
  • logging - learn how to hook into this crate's logging mechanisms.
  • migrations - learn about defining migrations to be run against your model's collection.

Good luck on the path.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].