# Mongoc errors in container with julia 1.9 libmongoc driver

**URL:** <https://discourse.julialang.org/t/mongoc-errors-in-container-with-julia-1-9-libmongoc-driver/106592>\
**Category:** General Usage\
**Created:** [November 22, 2023, 7:17pm UTC](https://discourse.julialang.org/t/mongoc-errors-in-container-with-julia-1-9-libmongoc-driver/106592 "2023-11-22T19:17:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ginger\_snaps](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ginger_snaps/32/203688_2.png) [@ginger\_snaps](https://discourse.julialang.org/u/ginger_snaps)\
**Post date:** [November 22, 2023, 7:17pm UTC](https://discourse.julialang.org/t/mongoc-errors-in-container-with-julia-1-9-libmongoc-driver/106592/1 "2023-11-22T19:17:38Z")

</div>

bHello! Everything was fine on my PC (I use Julia 1.8) but I needed to deploy the app in a container and could not find the official 1.8 image so I installed 1.9.  
The problem appeared with Mongoc package. I have the same versions in PC and container but errors were like

- mongoc\_collection\_find\_with\_opts (collection couldn’t be NULL) for Mongoc.find
- mongoc\_collection\_count\_documents (call couldn’t be NULL) for Mongoc.count\_documents
- etc

It seems that package Mongoc is only a wrapper for libmongoc (Mongo C driver). I use Windows so how I can check the version of this driver in Windows and put it in my docker file for Debian, it’s a nonsense error that occurs even if I wrap Mongoc.find with try-catch handling…  
Or maybe the problem is in Julia versions?

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [November 23, 2023, 1:22am UTC](https://discourse.julialang.org/t/mongoc-errors-in-container-with-julia-1-9-libmongoc-driver/106592/2 "2023-11-23T01:22:50Z")

</div>

Could you post thr entire actual error with stack trace?

---

<div class="post-metadata">

**Author:** ![ginger\_snaps](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ginger_snaps/32/203688_2.png) [@ginger\_snaps](https://discourse.julialang.org/u/ginger_snaps)\
**Post date:** [November 23, 2023, 12:55pm UTC](https://discourse.julialang.org/t/mongoc-errors-in-container-with-julia-1-9-libmongoc-driver/106592/3 "2023-11-23T12:55:41Z")

</div>

for example, simple function is\_presented even with try-catch

```julia
function is_presented(storage::MongoStorage, symbolname)   
    result = true
    try
        bson_filter = Mongoc.BSON("symbol" => symbolname)
        result = Mongoc.count_documents(storage.common_data, bson_filter) > 0
    catch e
        println(e)
        result = true
    end
    result  
end

```

Get the error

```julia
 The parameter: coll, in function mongoc_collection_count_documents, cannot be NULL

[42] signal (6.-6): Aborted
in expression starting at none:0
unknown function (ip: 0x7f9524140d3c)
gsignal at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
mongoc_collection_count_documents at /home/worker/.julia/artifacts/b4eaa7bb890b09ed9a8a26c2b79b8603c581c504/lib/libmongoc-1.0.so (unknown line)
mongoc_collection_count_documents at /home/worker/.julia/packages/Mongoc/tJNDW/src/c_api.jl:618 [inlined]
#count_documents#61 at /home/worker/.julia/packages/Mongoc/tJNDW/src/collection.jl:302 [inlined]
count_documents at /home/worker/.julia/packages/Mongoc/tJNDW/src/collection.jl:297 [inlined]
is_presented at /coinstrategies/history/src/StorageNew.jl:296

```

The stupidest thing is that 296 line is inside the try-catch

`result = Mongoc.count_documents(storage.common_data, bson_filter) > 0`

And it always work perfectly it is one one-liner function… Was… Than I wrap it with try-catch - no reaction. All warkers were aborted and app died.

---

<div class="post-metadata">

**Author:** ![ginger\_snaps](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ginger_snaps/32/203688_2.png) [@ginger\_snaps](https://discourse.julialang.org/u/ginger_snaps)\
**Post date:** [November 23, 2023, 12:57pm UTC](https://discourse.julialang.org/t/mongoc-errors-in-container-with-julia-1-9-libmongoc-driver/106592/4 "2023-11-23T12:57:54Z")

</div>

Nothing work properly. `Mongoc.find` get the same but with `mongoc_collection_find_with_opts`
