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 1d5b9e3 commit 75c7ae3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion extend/lbson/src/bson.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,8 @@ namespace lbson {
size_t sz;
const char* buf = lua_tolstring(L, -1, &sz);
if (buf[0] == 0 && sz >= 2) {
m_buffer.push_data((uint8_t*)buf + 1, sz - 1);
write_key((bson_type)buf[1], key, len);
if (sz > 2) m_buffer.push_data((uint8_t*)(buf + 2), sz - 2);
} else {
write_key(bson_type::BSON_STRING, key, len);
write_string(buf, sz);
Expand Down
4 changes: 2 additions & 2 deletions server/test/mongo_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ timer_mgr:once(2000, function()
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)})
icode, ierr = mongo_mgr:insert(primary_id, "test_mongo_1", {pid = 123457, uid = 3, time = quanta.now, ts = quanta.now_ms, tm = os.time() 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}})
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)

--[[
Expand Down

0 comments on commit 75c7ae3

Please sign in to comment.