mongo icon indicating copy to clipboard operation
mongo copied to clipboard

can't run the example

Open Omarabdul3ziz opened this issue 4 years ago • 3 comments

I am having an issue running the example

mongo.v:20:15: error: undefined ident: `bson`
   18 |     }
   19 | 
   20 |     user_bson := bson.new_from_json(json.encode(app))
      |                  ~~~~
   21 | 
   22 |     mongo.collection_insert_one(collection, user_bson)
mongo.v:22:8: error: unknown function: mongo.collection_insert_one
   20 |     user_bson := bson.new_from_json(json.encode(app))
   21 | 
   22 |     mongo.collection_insert_one(collection, user_bson)
      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   23 | }

I am using ubuntu 20.04 and installed the dependencies as following:

  • sudo apt-get install libmongoc-1.0-0
  • sudo apt-get install libbson-1.0
  • v install --git https://github.com/vlang/mongo

Omarabdul3ziz avatar Nov 02 '21 10:11 Omarabdul3ziz

Just try new version v up && v install mongo Try sudo apt-get install libmongoc-dev Try sudo apt-get install libbson-dev

enghitalo avatar Oct 01 '22 15:10 enghitalo

Hi! I'm trying to run examples but I just get the following error:

/home/franco/.vmodules/mongo/src/cursor.v:62:17: warning: reference field `C.bson_t.padding` must be initialized
   60 |     }
   61 | 
   62 |     document := &C.bson_t{}
      |                    ~~~~~~~~
   63 | 
   64 |     mut count := skip
/home/franco/.vmodules/mongo/src/cursor.v:62:17: warning: reference field `C.bson_t.padding` must be initialized
   60 |     }
   61 | 
   62 |     document := &C.bson_t{}
      |                    ~~~~~~~~
   63 | 
   64 |     mut count := skip
/home/franco/.vmodules/mongo/src/cursor.v:62:17: warning: reference field `C.bson_t.padding` must be initialized
   60 |     }
   61 | 
   62 |     document := &C.bson_t{}
      |                    ~~~~~~~~
   63 | 
   64 |     mut count := skip
==================
/tmp/v_1000/find-lean-example.1624789301257686966.tmp.c:23988: warning: assignment from incompatible pointer type
tcc: error: undefined symbol 'mongoc_client_new_from_uri_with_error'
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================
C error. This should never happen.

This is a compiler bug, please report it using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

FrancoPelussoCodeaIT avatar May 27 '23 07:05 FrancoPelussoCodeaIT

@FrancoPelussoCodeaIT can you check again with the new changes?

esquerbatua avatar Aug 21 '24 18:08 esquerbatua