bigplum / lua-resty-mongol

A ngx_lua driver for mongodb -- Deprecated for not updating with the mongodb version
198 stars 67 forks source link

Getting "attempt to call method 'new' (a nil value)" when running the test code. #8

Closed bnferguson closed 11 years ago

bnferguson commented 11 years ago

Running into this error even with the simplest code.

mongol = require "resty.mongol"
conn = mongol:new() 

Get the "attempt to call method 'new' (a nil value)" error on line 2.

Running off of github clone. Basic Lua hello world is working in Openresty. Any clues?

bnferguson commented 11 years ago

Here's the full error output in nginx's error log: https://gist.github.com/bnferguson/24f40f891b3e04501408

bigplum commented 11 years ago

Sorry for late response, please try to add "local" ahead of mongol:

    local mongo = require "resty.mongol"
    conn = mongo:new()
bnferguson commented 11 years ago

Progress! I could have sworn I tried that but apparently I did not. Thanks so much! (now to pick my local Lua experts brain as to what I was missing)

marcqualie commented 11 years ago

This is marked as resolved but it's still broken for me (even by putting local). I've opened a new issue over at #15 but I was just wondering if there was anything I might have missed that this ticket was resolved by.