Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A MongoDB module for Garry's Mod

License

NotificationsYou must be signed in to change notification settings

dhkatz/gmsv_mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A MongoDB module for Garry's Mod!

WindowsLinux
Build statusBuild Status

Quickstart

Information

Why does Garry's Mod need a MongoDB module? Because MongoDB is a NoSQL database.MySQL is designed for static schemas and performs best with complex queries.

Typically, the data stored by Garry's Mod servers is extremely dynamicand the queries performed are very simple. This makes MySQL a pain.

With MongoDB you don't have to worry about schemas at all! Just writeand query whatever data you want!

Download

Download a pre-built binary for your system from theReleases section.

Place the.dll ingarrysmod/lua/bin.

Usage

For more details see thedocumentation orexamples.

require('mongodb')-- Note: Connecting to the MongoDB cluster can hang! Cache the result in a global!client=clientormongodb.Client('<CONNECTION_URI>','<APP_NAME>')-- Retrieve databaseslocaldatabase=client:Database('test')-- Retrieve collectionslocalplayers=database:GetCollection('players')-- Run queries (Find, Insert, Update, Remove)localdata=players:Find({name='Bob',age=25 })print(data[1].name)players:Update({name='Bob'}, { ['$set']= {age=26 } })-- Execute bulk querieslocalbulk=players:Bulk()fori,plyinipairs({'Bob','Jim','Ann'})dobulk:Insert({name=ply,age=20+i })endlocalresult=bulk:Execute()

License

Code licensed under theMIT License.


[8]ページ先頭

©2009-2025 Movatter.jp