在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):daurnimator/mongol开源软件地址(OpenSource Url):https://github.com/daurnimator/mongol开源编程语言(OpenSource Language):Lua 100.0%开源软件介绍(OpenSource Introduction):Mongol - Lua Mongodb DriverWritten by daurnimator License is MIT/X11 Dependancieslua 5.1 luasocket InstallationCopy the mongol directory to somewhere lua will find it (eg; for linux the standard location is /usr/share/lua/5.1/ ) or more simply; use the provided make file:
UsageFunctions will generally raise errors if something unexpected happens Requring the module will return a function that connects to mongod: it takes a host (default localhost) and a port (default 27017); it returns a connection object.
###Connection objects have server wide methods. ####conn:cmd ( database_name , query , [collection] )
Returns the document
or ####bool , hosts = conn:ismaster ( ) Returns a boolean indicating if this is the master server and a table of other hosts this server is replicating with. ####newconn = conn:getprimary ( [already_checked] )
Returns a new connection object that is connected to the primary server
or The returned connection object may be this connection object itself. ####databases = conn:databases ( ) Returns a table describing databases on the server.
####conn:shutdown ( ) Shutsdown the server. Returns nothing. ####db = conn:new_db_handle ( database_name ) Returns a database object ###Database objects perform actions on a database ####db:list ( ) ####db:dropDatabase ( ) ####db:add_user ( username , password ) ####db:auth ( username , password ) ####db:count ( collection , query ) ####db:drop ( collection ) ####db:update ( collection , selector , update , upsert , multiupdate ) ####db:insert ( collection , docs , continue_on_error ) ####db:delete ( collection , selector , SingleRemove ) ####db:kill_cursors ( collection , cursorIDs ) ####db:query ( collection , query , returnfields , numberToSkip , numberToReturn , options ) ####db:getmore ( collection , cursorID , [numberToReturn] , [offset_i] )
####cursor = db:find ( collection , query , returnfields ) ###Cursor objects ####index , item = cursor:next ( ) Returns the next item and advances the cursor ####cursor:pairs ( ) A handy wrapper around cursor:next() that works in a generic for loop: for index , item in cursor:pairs() do Notes
TL;DR
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论