Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
local MongoClient = require("luaMongo.MongoClient")
local client = MongoClient.new("mongodb://localhost:27017/")
local exampleDatabase = client:getDatabase("exampleDB")
local exampleCollection = exampleDatabase:getCollection("exampleCollection")
-- Create document to insert.
local document_to_insert = {foo = "bar"}
-- Insert document into database
exampleCollection:insert_one(document_to_insert)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.