Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't run the example #9

Open
Omarabdul3ziz opened this issue Nov 2, 2021 · 3 comments
Open

can't run the example #9

Omarabdul3ziz opened this issue Nov 2, 2021 · 3 comments

Comments

@Omarabdul3ziz
Copy link

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
@enghitalo
Copy link
Contributor

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

@FrancoPelussoCodeaIT
Copy link

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

@esquerbatua
Copy link
Contributor

@FrancoPelussoCodeaIT can you check again with the new changes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants