Skip to content

Commit

Permalink
提交测试代码
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyoo0812 committed May 11, 2024
1 parent 71166de commit 1d5b9e3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/test/mongo_test.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
-- mongo_test.lua
local log_debug = logger.debug
local bdate = bson.date

local timer_mgr = quanta.get("timer_mgr")

Expand Down Expand Up @@ -33,6 +34,11 @@ timer_mgr:once(2000, function()
log_debug("db listIndexes code: {}, err = {}", icode, ierr)
icode, ierr = mongo_mgr:drop_indexes("test_mongo_2", "test_uid")
log_debug("db drop_indexes code: {}, err = {}", icode, ierr)

icode, ierr = mongo_mgr:insert(primary_id, "test_mongo_1", {pid = 123457, uid = 3, time = quanta.now_ms, ttl = bdate(quanta.now + 30)})
log_debug("db insert code: {}, err = {}", icode, ierr)
icode, ierr = mongo_mgr:create_indexes("test_mongo_1", {{key={pid,1,uid,1},name="test_uid", unique = true}})
log_debug("db create_indexes code: {}, err = {}", icode, ierr)

--[[
fcode, res = mongo_mgr:find("test_mongo_1", {}, {_id = 0}, {pid = 1})
Expand Down

0 comments on commit 1d5b9e3

Please sign in to comment.