datanoise / mongo.cr

Crystal binding for MongoDB C Driver
MIT License
97 stars 35 forks source link

fixes collection_command_simple call and streams in pooled mode #56

Closed elbywan closed 4 years ago

elbywan commented 4 years ago

Issue

It seems that the collection.cr command_simple function calls the LibMongoC.collection_command_simple binding with a missing argument.

In lib/mongo/src/mongo/collection.cr:63:18

 63 | if LibMongoC.collection_command_simple(self, command.to_bson, out reply, out error)
                   ^------------------------
Error: wrong number of arguments for 'LibMongoC#collection_command_simple' (given 4, expected 5)

Custom streams using a TCPSocket were not connecting to the db properly when in pooled mode, since polling is dedicated to a background thread unlike in single thread mode.

Done