Driver for Godot Engine

There is no server based database driver available with Godot Engine. If MongoDB developers are seeing this topic, will they consider the mongodb library for the Godot Engine?

Hi @Metehan_Ozbek, welcome!

Have you tried connecting to MongoDB using Godot C# scripting ? Looks like you can use NuGet packages in Godot, for example:

  <ItemGroup>
    <PackageReference Include="MongoDB.Driver" Version="2.10.2" />
  </ItemGroup> 

Or alternatively, you could also try to write a GDNative module either in C/C++. For example GDNative C++ , you should be able to write a module with mongocxx driver, see also Tutorial: MongoDB C++ driver.

Regards,
Wan.

I’m using gdscript. I don’t have enough skills because I don’t know C ++ :frowning:

Hi Wan,
I have tried what you suggested using C# and the NuGet package. I can successfully access the NuGet package but don’t seem to be able to connect to the database as I get the following error exception when i try to insert a document using:
collection.InsertOne(document);

I can get the same code to work using .NET but fails when run through Godot. Godot is using Mono, is the driver compatible with Mono?

Hi @Chris_Findlay,

The error you listed seems to be related to DnsClient, check that you have connection to the MongoDB server from Godot.

In my test, I could connect from Godot to a locally hosted MongoDB using the following URI: mongodb://127.0.0.1:27107/.

MongoDB .NET/C# driver is not being tested with Mono, although I’ve managed to create a simple test to query a document from MongoDB server using the current driver version 2.10.2. I’ve just added below lines to the csproj file:

      <ItemGroup>
        <PackageReference Include="MongoDB.Driver">
          <Version>2.10.2</Version>
        </PackageReference>
      </ItemGroup>

Tested with Godot Engine 3.2.1 stable mono official, Mono v6.8.0.105 on macOS 10.14.6.

Regards,
Wan.