The gmsv_mongo module enables the usage of MongoDB connections within Garry's Mod (GMod) via Rust. This opens up diverse possibilities for database interactions and management within GMod servers.
1. Download the correct file for your server operating system. You can execute the following console command to get the correct version.
lua_run print(jit.os, jit.arch)
2. Put the file in your garrysmod/lua/bin folder if it doesn't exists just create one.
3. Include the module in your code.
require('mongo');
Technologies used in the project:
To build the sample project in debug mode, you need to specify the target architecture for your build.
Platform | Command | Description |
---|---|---|
win32 |
cargo build --target i686-pc-windows-msvc |
Windows 32-bit Use this if your server is running Windows on the main branch of Garry's Mod (this is the default branch). |
win64 |
cargo build --target x86_64-pc-windows-msvc |
Windows 64-bit Use this if your server is running Windows on the x86-64 branch of Garry's Mod. |
linux |
cargo build --target i686-unknown-linux-gnu |
Linux 32-bit Use this if your server is running Linux on the main branch of Garry's Mod (this is the default branch). |
linux64 |
cargo build --target x86_64-unknown-linux-gnu |
Linux 64-bit Use this if your server is running Linux on the x86-64 branch of Garry's Mod. |
If Rust reports it cannot find the target/toolchain, you may need to install it. By default, Rust installs the native
toolchain for your system, which is likely Windows 64-bit (x86_64-pc-windows-msvc
).
Cross-compiling Linux binaries on Windows is not recommended. For compiling Linux binaries on Windows, use WSL.
First, rename the compiled binary to gmsv_mongo_PLATFORM.dll
, where PLATFORM
corresponds to one of the following:
Platform | Description |
---|---|
win32 |
Windows 32-bit Use this if your server is running Windows on the main branch of Garry's Mod (this is the default branch). |
win64 |
Windows 64-bit Use this if your server is running Windows on the x86-64 branch of Garry's Mod. |
linux |
Linux 32-bit Use this if your server is running Linux on the main branch of Garry's Mod (this is the default branch). |
linux64 |
Linux 64-bit Use this if your server is running Linux on the x86-64 branch of Garry's Mod. |
Next, move the renamed binary to garrysmod/lua/bin/
on your server. If the bin
folder does not exist, create it.
Finally, you can load the module from Lua with:
require("mongo")
For some examples on how to use the module, check out the examples folder.
- Fedox-the-Duck - Creator of the project
- Austria7 - Contributor and helper of the project
- PolEpie - Helped me start this project and gave me some tips on rust.
This project is licensed under the AGPL-3.0
Leave a ⭐ on this repository :D