vlang / mongo

Official MongoDB driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't run find

brunobach opened this issue · comments

I'm having trouble doing a basic find.

query := mongo.new_from_json('{}')
count := collection.count_documents(query)
println(count) // 69 return ok

bson_doc := mongo.new_bson()
cursor := collection.find(query)

for cursor.next(&bson_doc) {
   str := mongo.as_canonical_extended_json(bson_doc)
   println(str)
}

it returns me the following error:

mongo.v:19:20: error: unknown function: mongo.as_canonical_extended_json
   17 | 
   18 |      for cursor.next(&bson_doc) {
   19 |       str := mongo.as_canonical_extended_json(bson_doc)
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   20 |       println(str)
   21 |     }
# Ubuntu 20.04
# apt list --installed
libmongoc-1.0-0/focal,now 1.16.1-1build2 amd64 [installed]
libmongoc-dev/focal,now 1.16.1-1build2 amd64 [installed]
libbson-1.0-0/focal,now 1.16.1-1build2 amd64 [installed]
libbson-dev/focal,now 1.16.1-1build2 amd64 [installed]

Just try new version v up && v install mongo