mongo
mongo copied to clipboard
Error when using insert_one()
Error when using function collection.insert_one()
.
Code:
module sublib
import mongo
fn main() {
mongo_uri := mongo.uri_new('xxx')
client := mongo_uri.get_database('discord_bot')
col := client.get_collection('discord_bot', 'user_data')
col.insert_one({
'str': 'string'
'number': 2
'float': 2.1
'boolean': true
})
response := col.find({
'str': 'string'
}).lean()
assert response[0].as_map()['str'] or { 0 }.str() == 'string'
}
Error:
C:/Users/xxx/.vmodules/mongo/src/collection.v:36:75: error: cannot use `&&C.bson_t` as `&C.bson_t` in argument 4 to `C.mongoc_collection_insert_one`
34 | reply := new_bson()
35 |
36 | result := C.mongoc_collection_insert_one(collection, document_bson_t, 0, &reply, &error)
| ~~~~~~
37 | unsafe { println(C.bson_as_json(&reply, 0).vstring()) }
38 | if unsafe { error.message.vstring() != '' } {
I've already updated V and Mongo-V. Hopefully this question is adequately formatted.
@enghitalo. Please, create tests
@enghitalo https://github.com/vlang/mongo/pull/25
@enghitalo https://github.com/vlang/mongo/pull/25
Thank you!!!
Hi @nac5604 can you check again with the new commits?