Giter Club home page Giter Club logo

Comments (3)

saghm avatar saghm commented on August 16, 2024

From running this code on my own machine, it appears that the unwrapping actually occurs in your own code on line 56, namely let mut cursor = collection.find(None, None).unwrap(); You can verify this by using gdb to run the actual binary file generated in the target subdirectory and setting a breakpoint at rust_panic.

One thing that's a bit subtle about Client::connect is that the errors tht it returns actually have to do with properly initializing the mutex and with creating the topology. You can look at Client::with_config (which is called by Client::connect to see the details of this.

On a slightly unrelated note, creating a new Client on every request is fairly inefficient. Client is actually just an alias of an Arc type, which means you can open the connection at the top of the function and then just use .clone() to get an (owned) atomic reference to it inside each of your routes that need it.

from mongo-rust-driver-prototype.

w-k-s avatar w-k-s commented on August 16, 2024

Thank you so much for such an informative response.
I had an uneasy feeling about creating multiple clients; I was mislead by a tutorial. Thanks for setting me straight
And I hadn't played with the debugger before posting this ticket. I see that it is indeed a fault of my own!

from mongo-rust-driver-prototype.

vkarpov15 avatar vkarpov15 commented on August 16, 2024

Thanks @saghm

from mongo-rust-driver-prototype.

Related Issues (20)

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.