Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 77 lines (64 sloc) 2.321 kb
edd74e6 Initial checkin
nrich@ii.net authored
1 /*
2 * Copyright (c) 2009 Neil Richardson (nrich@iinet.net.au)
3 *
668f223 Cleaned up whitespace (spaces only)
neomantra authored
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
edd74e6 Initial checkin
nrich@ii.net authored
5 * of this software and associated documentation files (the "Software"), to deal
668f223 Cleaned up whitespace (spaces only)
neomantra authored
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
edd74e6 Initial checkin
nrich@ii.net authored
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in all
12 * copies or substantial portions of the Software.
13 *
668f223 Cleaned up whitespace (spaces only)
neomantra authored
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
edd74e6 Initial checkin
nrich@ii.net authored
20 * IN THE SOFTWARE.
21 */
22
23 extern "C" {
24 #include <lua.h>
25 #include <lauxlib.h>
26 #include <lualib.h>
27
28 #if !defined(LUA_VERSION_NUM) || (LUA_VERSION_NUM < 501)
29 #include <compat-5.1.h>
30 #endif
31 };
32
33 #include <iostream>
34 #include <client/dbclient.h>
35
36 #include "utils.h"
37 #include "common.h"
38
f078a4d add support for specifying BSON types
neomantra@gmail.com authored
39 extern int mongo_bsontypes_register(lua_State *L);
b0ac7ce * Added Query object for advanced querying
nrich@ii.net authored
40 extern int mongo_connection_register(lua_State *L);
90e2fdf @neomantra Added ReplicaSet support
neomantra authored
41 extern int mongo_replicaset_register(lua_State *L);
b0ac7ce * Added Query object for advanced querying
nrich@ii.net authored
42 extern int mongo_cursor_register(lua_State *L);
43 extern int mongo_query_register(lua_State *L);
9adfb70 Initial cut of GridFS support
nrich@ii.net authored
44 extern int mongo_gridfs_register(lua_State *L);
45 extern int mongo_gridfile_register(lua_State *L);
41c68de * Finish GridFS support
nrich@ii.net authored
46 extern int mongo_gridfschunk_register(lua_State *L);
edd74e6 Initial checkin
nrich@ii.net authored
47
48 /*
49 *
50 * library entry point
51 *
52 */
53
54 extern "C" {
55
56 LM_EXPORT int luaopen_mongo(lua_State *L) {
f078a4d add support for specifying BSON types
neomantra@gmail.com authored
57 mongo_bsontypes_register(L);
edd74e6 Initial checkin
nrich@ii.net authored
58 mongo_connection_register(L);
90e2fdf @neomantra Added ReplicaSet support
neomantra authored
59 mongo_replicaset_register(L);
edd74e6 Initial checkin
nrich@ii.net authored
60 mongo_cursor_register(L);
b0ac7ce * Added Query object for advanced querying
nrich@ii.net authored
61 mongo_query_register(L);
edd74e6 Initial checkin
nrich@ii.net authored
62
9adfb70 Initial cut of GridFS support
nrich@ii.net authored
63 mongo_gridfs_register(L);
64 mongo_gridfile_register(L);
41c68de * Finish GridFS support
nrich@ii.net authored
65 mongo_gridfschunk_register(L);
9adfb70 Initial cut of GridFS support
nrich@ii.net authored
66
edd74e6 Initial checkin
nrich@ii.net authored
67 /*
68 * push the created table to the top of the stack
69 * so "mongo = require('mongo')" works
70 */
35294b2 Add query options constants
nrich@ii.net authored
71 lua_getglobal(L, LUAMONGO_ROOT);
edd74e6 Initial checkin
nrich@ii.net authored
72
73 return 1;
74 }
75
76 }
Something went wrong with that request. Please try again.