文件名称:MongoDB的Lua开发包luamongo.zip
文件大小:42KB
文件格式:ZIP
更新时间:2022-08-06 00:10:21
开源项目
luamongo is a Lua library that wraps the mongodb C API 示例代码: require('mongo') -- Create a connection object local db = assert(mongo.Connection.New()) -- connect to the server on localhost assert(db:connect('localhost')) -- insert a value into the namespace 'test.values' assert(db:insert('test.values', {a = 10, b = 'str1'})) -- the same using a JSON string assert(db:insert('test.values', "{'a': 20, 'b': 'str2'}")) -- insert a multiple values into the namespace 'test.values' assert(db:insert_batch('test.values', {{a = 10, b = 'str1'}, {c = 11, d = 'str2'}})) -- print the number of rows in the namespace 'test.values' print(db:count('test.values')) -- query all the values in the namespace 'test.values' local q = assert(db:query('test.values', {})) -- loop through the result set for result in q:results() do print(result.a) print(result.b) end 标签:luamongo
【文件预览】:
luamongo-master
----.gitmodules(129B)
----CHANGESLIST.md(369B)
----.dir-locals.el(177B)
----mongo_dbclient.cpp(25KB)
----mongo_connection.cpp(3KB)
----utils.cpp(12KB)
----common.h(2KB)
----rockspec()
--------luamongo-scm-0.rockspec(785B)
--------luamongo-v0.4-4.rockspec(779B)
--------luamongo-v0.4-2.rockspec(779B)
--------luamongo-v0.4-3.rockspec(779B)
--------luamongo-v0.1-0.rockspec(775B)
--------luamongo-v0.4-1.rockspec(779B)
--------luamongo-v0.2-0.rockspec(775B)
----mongo_cursor.cpp(5KB)
----tests()
--------replicaset.lua(2KB)
--------lunity.lua(10KB)
--------connection.lua(2KB)
----mongo_gridfile.cpp(6KB)
----LICENSE(1KB)
----mongo_replicaset.cpp(3KB)
----mongo_gridfilebuilder.cpp(4KB)
----debian()
--------control(704B)
--------docs(0B)
--------changelog(959B)
--------compat(2B)
--------install(24B)
--------copyright(2KB)
--------rules(600B)
----mongo_query.cpp(10KB)
----mongo_gridfs.cpp(7KB)
----main.cpp(4KB)
----.gitignore(252B)
----utils.h(3KB)
----mongo_bsontypes.cpp(9KB)
----Makefile(4KB)
----mongo_gridfschunk.cpp(2KB)
----README.md(5KB)
----external()
--------mongo-cxx-driver()