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

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

    Full MongoDB Support

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

    Production Ready

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

    Easy Integration

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

    Async Operations

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

    Migration Friendly

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

Key Features

    CRUD Operations

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

    Aggregation Pipelines

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

    Index Management

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

    Connection Management

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

    Type Safety

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

    Error Handling

    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.