lua-mongo 是对 MongoDB C Driver 1.16 或更高版本的 Lua 的绑定,githup仓库:https://github.com/neoxic/lua-mongo
通过luarocks方式安装lua模块
一、安装luarocks工具,官网:https://luarocks.org/
二、安装lua-mongo模块
1 | luarocks install lua-mongo |
安装时,报以下错误信息
Error: Could not find expected file libmongoc-1.0/mongoc.h, or libmongoc-1.0/mongoc.h for LIBMONGOC – you may have to install LIBMONGOC in your system and/or pass LIBMONGOC_DIR or LIBMONGOC_INCDIR to the luarocks command. Example: luarocks install mongorover LIBMONGOC_DIR=/usr/local
三、安装cmake
因为mongo-c-driver需要使用cmake进行编译
1 | yum install gcc gcc-c++ ncurses-devel |
四、安装libmongoc库
官方安装参照:http://mongoc.org/
1 | wget https://github.com/mongodb/mongo-c-driver/releases/download/1.17.6/mongo-c-driver-1.17.6.tar.gz |
再执行,安装lua-mongo模块
1 | luarocks install lua-mongo |
安装成功