Permalink
Browse files

Add query options constants

git-svn-id: http://luamongo.googlecode.com/svn/trunk@48 17e306f6-9439-11de-a13a-71b910e68cc8
  • Loading branch information...
1 parent e74a8e9 commit 35294b2682aa800a37d4f971d31208eabdecb552 nrich@ii.net committed Aug 11, 2010
Showing with 34 additions and 1 deletion.
  1. +1 −1 main.cpp
  2. +33 −0 mongo_query.cpp
View
@@ -66,7 +66,7 @@ LM_EXPORT int luaopen_mongo(lua_State *L) {
* push the created table to the top of the stack
* so "mongo = require('mongo')" works
*/
- lua_getglobal(L, "mongo");
+ lua_getglobal(L, LUAMONGO_ROOT);
return 1;
}
View
@@ -356,5 +356,38 @@ int mongo_query_register(lua_State *L) {
luaL_register(L, LUAMONGO_QUERY, query_class_methods);
+ lua_pushstring(L, "Options");
+ lua_newtable(L);
+
+ lua_pushstring(L, "CursorTailable");
+ lua_pushinteger(L, QueryOption_CursorTailable);
+ lua_rawset(L, -3);
+
+ lua_pushstring(L, "SlaveOk");
+ lua_pushinteger(L, QueryOption_SlaveOk);
+ lua_rawset(L, -3);
+
+ lua_pushstring(L, "OplogReplay");
+ lua_pushinteger(L, QueryOption_OplogReplay);
+ lua_rawset(L, -3);
+
+ lua_pushstring(L, "NoCursorTimeout");
+ lua_pushinteger(L, QueryOption_NoCursorTimeout);
+ lua_rawset(L, -3);
+
+ lua_pushstring(L, "AwaitData");
+ lua_pushinteger(L, QueryOption_AwaitData);
+ lua_rawset(L, -3);
+
+ lua_pushstring(L, "Exhaust");
+ lua_pushinteger(L, QueryOption_Exhaust);
+ lua_rawset(L, -3);
+
+ lua_pushstring(L, "AllSupported");
+ lua_pushinteger(L, QueryOption_AllSupported);
+ lua_rawset(L, -3);
+
+ lua_rawset(L, -3);
+
return 1;
}

0 comments on commit 35294b2

Please sign in to comment.