API Reference
API Reference
Complete reference for all gmsv_mongo classes and methods
API Reference
Complete reference documentation for all gmsv_mongo classes, methods, and functions.
Overview
gmsv_mongo provides the following main components:
- MongoDB - Global table with client creation and utility functions
- MongoDBClient - Connection to MongoDB deployment
- MongoDBDatabase - Database operations
- MongoDBCollection - Collection operations (CRUD, aggregation, indexes)
Topics
Quick Reference
Client Creation
-- Basic connection
MongoDB.Client(connectionString) → MongoDBClient | nil
-- Connection with options
MongoDB.ClientWithOptions(connectionString, options) → MongoDBClient | nil
Database Operations
client:Database(name) → MongoDBDatabase
client:ListDatabases() → table | nil
Collection Operations
db:Collection(name) → MongoDBCollection
db:ListCollections() → table | nil
db:CreateCollection(name) → boolean
db:DropCollection(name) → boolean
CRUD Operations
-- Create
collection:InsertOne(document) → string | nil
collection:InsertMany(documents) → table | nil
-- Read
collection:Find(filter [, limit]) → table | nil
collection:FindOne(filter) → table | nil
collection:Count(filter) → number
-- Update
collection:UpdateOne(filter, update [, upsert]) → number
collection:UpdateMany(filter, update [, upsert]) → number
-- Delete
collection:DeleteOne(filter) → number
collection:DeleteMany(filter) → number
Async Operations
collection:InsertOneAsync(document, callback)
collection:InsertManyAsync(documents, callback)
collection:FindAsync(filter, callback)
collection:FindOneAsync(filter, callback)
collection:CountAsync(filter, callback)
collection:UpdateOneAsync(filter, update, callback)
collection:UpdateManyAsync(filter, update, callback)
collection:DeleteOneAsync(filter, callback)
collection:DeleteManyAsync(filter, callback)
collection:AggregateAsync(pipeline, callback)
Advanced Operations
-- Aggregation
collection:Aggregate(pipeline) → table | nil
-- Indexes
collection:CreateIndex(keys, unique, name) → string | nil
collection:ListIndexes() → table | nil
collection:DropIndex(name) → boolean
Utilities
MongoDB.Version() → string
MongoDB.SuppressMessages(boolean)