Installing gmsv_mongo is straightforward. Follow these steps to get the MongoDB driver running on your Garry's Mod server.
Before installing gmsv_mongo, ensure you have:
First, you need to identify which binary you need for your server. Run this command in your GMod server console:
lua_run print(jit.os, jit.arch)
This will output something like:
Linux x86 - Linux 32-bitLinux x64 - Linux 64-bitWindows x86 - Windows 32-bitWindows x64 - Windows 64-bitMost modern GMod servers run on Linux x86 (32-bit) by default, even on 64-bit operating systems. Make sure to download the correct binary for your server, not your OS.
Download the appropriate binary for your platform from the GitHub Releases page:
| Platform | Binary Name | When to Use |
|---|---|---|
| Linux 32-bit | gmsv_mongo_linux.dll | Default GMod branch on Linux |
| Linux 64-bit | gmsv_mongo_linux64.dll | x86-64 GMod branch on Linux |
| Windows 32-bit | gmsv_mongo_win32.dll | Default GMod branch on Windows |
| Windows 64-bit | gmsv_mongo_win64.dll | x86-64 GMod branch on Windows |
The .dll extension is used for all platforms in GMod's binary module system, even on Linux. Don't try to rename it to .so!
garrysmod/lua/bin/ folder
bin folder doesn't exist, create it# Example directory structure
garrysmod/
├── lua/
│ ├── bin/
│ │ └── gmsv_mongo_linux.dll # Your binary here
│ ├── autorun/
│ └── ...
├── addons/
└── ...
Create a test script to verify the installation. Create garrysmod/lua/autorun/server/test_mongo.lua:
-- Test MongoDB connection
require("mongo")
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
print("gmsv_mongo Module Loaded!")
print("Version:", MongoDB.Version())
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")
-- Test connection (update with your MongoDB details)
timer.Simple(1, function()
local success, client = pcall(function()
return MongoDB.Client("mongodb://localhost:27017")
end)
if success and client then
print("✓ MongoDB connection successful!")
-- List databases
local dbs = client:ListDatabases()
if dbs then
print("Available databases:", table.concat(dbs, ", "))
end
else
print("✗ MongoDB connection failed!")
print("Make sure MongoDB is running and accessible")
end
end)
Start or restart your Garry's Mod server. Check the console output for the test messages.
If you see:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
gmsv_mongo Module Loaded!
Version: 2.0.0
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✓ MongoDB connection successful!
Congratulations! gmsv_mongo is installed and working.
Solution:
garrysmod/lua/bin/Solution:
systemctl status mongod (Linux) or check Services (Windows)mongosh or MongoDB CompassSolution:
lua_run print(jit.os, jit.arch)