change api name bson.encode_order

This commit is contained in:
Cloud Wu
2014-03-12 15:01:13 +08:00
parent b9aefc3ebc
commit b502d34da3
2 changed files with 6 additions and 6 deletions

View File

@@ -857,12 +857,12 @@ lencode(lua_State *L) {
}
static int
lencode_sorted(lua_State *L) {
lencode_order(lua_State *L) {
struct bson b;
bson_create(&b);
int n = lua_gettop(L);
if (n%2 != 0) {
return luaL_error(L, "Invalid sorted dict");
return luaL_error(L, "Invalid ordered dict");
}
pack_sorted_dict(L, &b, n);
lua_settop(L,1);
@@ -1161,7 +1161,7 @@ luaopen_bson(lua_State *L) {
}
luaL_Reg l[] = {
{ "encode", lencode },
{ "encode_sorted", lencode_sorted },
{ "encode_order", lencode_order },
{ "date", ldate },
{ "timestamp", ltimestamp },
{ "regex", lregex },

View File

@@ -6,7 +6,7 @@ local rawget = rawget
local assert = assert
local bson_encode = bson.encode
local bson_encode_sorted = bson.encode_sorted
local bson_encode_order = bson.encode_order
local bson_decode = bson.decode
local empty_bson = bson_encode {}
@@ -182,9 +182,9 @@ function mongo_db:runCommand(cmd,cmd_v,...)
local sock = conn.__sock
local bson_cmd
if not cmd_v then
bson_cmd = bson_encode_sorted(cmd,1)
bson_cmd = bson_encode_order(cmd,1)
else
bson_cmd = bson_encode_sorted(cmd,cmd_v,...)
bson_cmd = bson_encode_order(cmd,cmd_v,...)
end
local pack = driver.query(request_id, 0, self.__cmd, 0, 1, bson_cmd)
-- todo: check send