Comments (3)
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.
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.
Thanks @saghm
from mongo-rust-driver-prototype.
Related Issues (20)
- Authentication succeeds while it shouldn't HOT 14
- Load all documents at once instead of getting a cursor HOT 2
- Duplicate Key error not detected HOT 10
- Large writes fail with broken pipe error HOT 2
- Cursor getMore OperationErrors not handled properly. HOT 4
- No servers available for the provided ReadPreference, yet again HOT 12
- Serialize struct with u32 field HOT 5
- problem on DateTime<Utc> type HOT 1
- Old FindOneAndUpdate struct HOT 2
- How to set slaveOk with atlas replica set? HOT 2
- Is there any way to reconnect the db again? HOT 4
- Schema validation HOT 2
- Example in README is not working HOT 1
- Authentication failure when using with actix-web HOT 2
- Does auth() actually works on Mongo 4.2.0? HOT 2
- Performance is still bad #2 HOT 8
- AWS DocumentDB compatibility HOT 4
- ClientInner never release HOT 4
- Document from HashMap HOT 2
- Project Status HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongo-rust-driver-prototype.