Git Product home page Git Product logo

avocado's People

Contributors

h2co3 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

figments flitbit

avocado's Issues

How to upsert

Hello, the crate is amazing but the docs are missing somewhere.
For example, I have a vector of struct which implements Doc. Now I want to upsert_many: insert if does not exist and update content if exists.
Should I really need to create another struct-operation, implement Upsert trait for it and use it for this operation? Maybe there is a simple way for this?

No info about inserted_ids on insert_many when there were some exceptions

Hey ho! :)
It works, but now we don't have info about inserted_ids when ordered = false.

avocado/avocado/src/coll.rs

Lines 149 to 157 in e430353

self.inner
.insert_many(docs, options.into())
.chain(&message)
.and_then(|result| {
if let Some(error) = result.bulk_write_exception {
Err(Error::with_cause(message(), error))
} else if let Some(ids) = result.inserted_ids {
let ids = ids
.into_iter()

So you check result and if there were bulk error, drop the request as failed. But InsertManyResult also contains info about inserted ids:

pub struct InsertManyResult {
    pub acknowledged: bool,
    pub inserted_ids: Option<BTreeMap<i64, Bson>>,
    pub bulk_write_exception: Option<BulkWriteException>,
}

And I can't understand in code that transaction is okay and how many rows were anyway inserted because of ordered = false.

I'm not sure what's the correct way to handle such situation. Maybe when ordered=false in insert many, don't return Err if result was BulkWriteException and mark it always as success?

Statically typed filters?

Is it possible to write statically typed filters? (e.g. similar to what diesel has or something else), and if not, is there any plans for them?

Something like:

#[derive(Debug, Serialize, Deserialize, Doc, Clone)]
pub struct Example {
	#[serde(rename = "_id")]
	pub id: Uid<Example>,
	pub description: String,
}

...

let example_col: Collection<Example>  = shared.db.existing_collection();
let res: Example = example_col.find_one(Example::description.eq("abc"));

Doc for generic struct

Hi! Thanks again for amazing wrapper :)
I found, that it's not possible to derive Doc for generic structure:

> message: `Doc` can't be derived for a type that is generic over type parameters

#[derive(Doc, Serialize, Deserialize)]
pub struct Test<T: Serialize + Deserialize> {
   pub data<T>
}

We specify Output type for queries, maybe we also can specify somehow exact types for deserialization?

Counters in the README are slightly off?

The "fuck counter" and the "goto counter" (does that one even make sense in Rust?) both show 1, but the only result is their entry in the README...
And the "unsafe counter" shows three, but the results are (again) the counter in the README, and then the #![deny(...)] entries which should make it impossible to have unsafe code...

I don't know if this is intentional, but it sounds like the counters don't really make sense. Just wanted to let you know :)

SSL?

There doesn't seem to be a feature or any documentation for SSL connections. Is that by design or does SSL just work if you need to use it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.