Power Your Garry's Mod Server with MongoDB.

A high-performance MongoDB driver for Garry's Mod featuring full async support, connection pooling, aggregation pipelines, index management, and comprehensive CRUD operations. Built for modern game servers.

example.lua
  local client = MongoDB.Client("mongodb://localhost:27017")
local db = client:Database("gameserver")
local players = db:Collection("players")

-- Insert a player
local id = players:InsertOne({
    steamid = "STEAM_0:1:12345",
    username = "Player1",
    level = 5
})

-- Find players
local results = players:Find({ level = { ["$gte"] = 5 } })

Why Choose gmsv_mongo?

High Performance

Full MongoDB Support

Production Ready

Easy Integration

Async Operations

Migration Friendly

Built with Rust for maximum performance. Features connection pooling, async operations, and optimized BSON conversion for lightning-fast database interactions. :::

Complete MongoDB feature set including aggregation pipelines, index management, bulk operations, and all query/update operators. :::

Robust error handling, detailed logging, configurable connection options, and backward compatibility ensure reliable operation in production environments. :::

Simple Lua API that feels natural in Garry's Mod. Automatic type conversion between Lua and BSON. Comprehensive examples and migration guides. :::

Non-blocking database operations prevent server lag. Connection pooling and retry mechanisms handle high-load scenarios gracefully. :::

Easy migration from older versions with detailed guides. Maintain data integrity and minimize downtime during upgrades. :::

Key Features

CRUD Operations

Aggregation Pipelines

Index Management

Connection Management

Type Safety

Error Handling

Complete Create, Read, Update, Delete operations with support for single and bulk operations. FindOne, Count, and advanced query operators. :::

Powerful data analysis with MongoDB's aggregation framework. Group, sort, filter, and transform data with complex pipelines. :::

Create, list, and drop indexes for query optimization. Support for unique, compound, and custom indexes to improve performance. :::

Flexible connection options with authentication, TLS, connection pooling, and retry policies. Multiple database and collection operations. :::

Automatic conversion between Lua tables and BSON documents. Support for ObjectIds, dates, and all MongoDB data types. :::

Comprehensive error reporting with detailed messages. Configurable logging levels and graceful failure handling. :::

Ready to enhance your Garry's Mod server?

Join other server owners using gmsv_mongo for reliable, high-performance database operations. Get started with comprehensive documentation and examples.