Created
May 14, 2014 09:11
-
-
Save cloudwu/09f90da476f69baffd68 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local skynet = require "skynet" | |
local mongo = require "mongo" | |
skynet.start(function() | |
local db = mongo.client { host = "127.0.0.1" , username = "user", password = "pass" } | |
local r = db:runCommand "listDatabases" | |
for k,v in ipairs(r.databases) do | |
print(v.name) | |
end | |
local loc = db:getDB "hello" | |
local c = loc.system.namespaces:find() | |
while c:hasNext() do | |
local r = c:next() | |
print(r.name) | |
end | |
db:disconnect() | |
skynet.exit() | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment