Skip to content

Instantly share code, notes, and snippets.

@danared
Last active August 28, 2015 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danared/950a58920dd96c1df5bd to your computer and use it in GitHub Desktop.
Save danared/950a58920dd96c1df5bd to your computer and use it in GitHub Desktop.
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