Skip to content

Moongo is an Object-Document Mapper for working with MongoDB in Lua.

License

Notifications You must be signed in to change notification settings

jigordev/lua-moongo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moongo

Moongo is an Object-Document Mapper for working with MongoDB in Lua.

Usage

Installation

You can install moongo using luarocks:

luarocks install lua-moongo

Basic Usage

local class = require("middleclass")
local moongo = require("moongo")
local fields = require("moongo.fields")

local client = moongo.MongoClient:new("moongo_db")

local People = class("People", moongo.Document)
People:set_config({ database = client.db, collection = "people" })
People:set_fields({
	name = fields.StringField({max_length=30}),
	age = fields.IntField()
})

local people = People.objects:filter({name = "John"}):first()

if people then
	print(people.name)
end

License

Moongo is licensed under the MIT License. See the LICENSE file for details.

About

Moongo is an Object-Document Mapper for working with MongoDB in Lua.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages