SSPkrolik / nimongo

Pure Nim lang MongoDB driver
http://sspkrolik.github.io/nimongo
MIT License
101 stars 20 forks source link

Fix db reply parsing #24

Closed goldenreign closed 7 years ago

goldenreign commented 7 years ago

Main reason to do this PR is that insert proc always failed on response["n"] conversion. This is because value of response["n"] is BsonKindDouble. nimongotest.nim failed too.

To fix it I have unified database reply parsing. This should fix several issues like in insert but not break backwards compatibility. This also adds errmsg to ReplyStatus if error occurs in all cases.

Tested with

nim --version
Nim Compiler Version 0.15.1 (2016-10-15) [Linux: amd64]
git hash: 2d2b1a9d481bffaecac35e1e52929cea66f69e0e
mongod --version
db version v3.3.15
git version: 520f5571d039b57cf9c319b49654909828971073

nimongotest.nim green (fixed and updated it).