Index: library/mongodb/README =================================================================== diff -u -r04b17cf850af721f6ad1760dece06ef78b11da83 -r42ba8471f7620b850b6296f753cbc3079fe5c6cd --- library/mongodb/README (.../README) (revision 04b17cf850af721f6ad1760dece06ef78b11da83) +++ library/mongodb/README (.../README) (revision 42ba8471f7620b850b6296f753cbc3079fe5c6cd) @@ -6,7 +6,7 @@ https://github.com/mongodb/mongo-c-driver The current version is tested with -- MongoDB v2.4.4-pre- +- MongoDB v2.4.5 - mongodb-c-driver v0.7.1 Compile or obtain mongodb (the database). Index: library/mongodb/configure.ac =================================================================== diff -u --- library/mongodb/configure.ac (revision 0) +++ library/mongodb/configure.ac (revision 42ba8471f7620b850b6296f753cbc3079fe5c6cd) @@ -0,0 +1,314 @@ +#!/bin/bash -norc +dnl This file is an input file used by the GNU "autoconf" program to +dnl generate the file "configure", which is run during Tcl installation +dnl to configure the system for the local environment. +# + +#----------------------------------------------------------------------- +# Sample configure.in for Tcl Extensions. The only places you should +# need to modify this file are marked by the string __CHANGE__ +#----------------------------------------------------------------------- + +configdir=$(srcdir)/../../config + +#----------------------------------------------------------------------- +# __CHANGE__ +# Set your package name and version numbers here. +# +# This initializes the environment with PACKAGE_NAME and PACKAGE_VERSION +# set as provided. These will also be added as -D defs in your Makefile +# so you can encode the package version directly into the source files. +#----------------------------------------------------------------------- + +AC_INIT([nsfmongo], [0.1]) + +#-------------------------------------------------------------------- +# Call TEA_INIT as the first TEA_ macro to set up initial vars. +# This will define a ${TEA_PLATFORM} variable = "unix" or "windows" +# as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE. +#-------------------------------------------------------------------- + +TEA_INIT([3.9]) + +AC_CONFIG_AUX_DIR(../../config) + +#-------------------------------------------------------------------- +# specify some extra flags +#-------------------------------------------------------------------- +AC_ARG_WITH(mongo, + [ --with-mongo=MONGO_INCLUDE_DIR[,MONGO_LIB_DIR] + absolute path to bson.h and optionally the path to the library, + --without-mongo disables build of the mongo interface], + [with_mongo=$withval], [with_mongo=no]) + +AC_ARG_WITH(nsf, + [ --with-nsf=DIR_CONTAINING_NSFCONFIG_SH + absolute path to nsfConfig.sh, + --without-nsf disables, but this is pointless], + [with_nsf=$withval], [AC_MSG_ERROR([--with-nsf is required])]) + +#-------------------------------------------------------------------- +# Load the tclConfig.sh file +#-------------------------------------------------------------------- + +TEA_PATH_TCLCONFIG +TEA_LOAD_TCLCONFIG + +#-------------------------------------------------------------------- +# Load the tkConfig.sh file if necessary (Tk extension) +#-------------------------------------------------------------------- + +#TEA_PATH_TKCONFIG +#TEA_LOAD_TKCONFIG + +#----------------------------------------------------------------------- +# Handle the --prefix=... option by defaulting to what Tcl gave. +# Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER. +#----------------------------------------------------------------------- + +TEA_PREFIX + +#----------------------------------------------------------------------- +# Standard compiler checks. +# This sets up CC by using the CC env var, or looks for gcc otherwise. +# This also calls AC_PROG_CC, AC_PROG_INSTALL and a few others to create +# the basic setup necessary to compile executables. +#----------------------------------------------------------------------- + +TEA_SETUP_COMPILER + +#----------------------------------------------------------------------- +# __CHANGE__ +# Specify the C source files to compile in TEA_ADD_SOURCES, +# public headers that need to be installed in TEA_ADD_HEADERS, +# stub library C source files to compile in TEA_ADD_STUB_SOURCES, +# and runtime Tcl library files in TEA_ADD_TCL_SOURCES. +# This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS +# and PKG_TCL_SOURCES. +#----------------------------------------------------------------------- +if test ! "${with_mongo}" = no; then + MONGO_INC_DIR="`echo $with_mongo |cut -f1 -d,`" + MONGO_LIB_DIR="`echo $with_mongo |cut -f2 -d, -s`" +fi +if test -z "$MONGO_INC_DIR" ; then + gdbm_h_ok=1 + MONGO_INC_SPEC="" +else + MONGO_INC_SPEC="-I${MONGO_INC_DIR}" + echo "Checking ${MONGO_INC_DIR}/bson.h" + if test -f "${MONGO_INC_DIR}/bson.h" ; then + mongo_h_ok=1 + else + mongo_h_ok=0 + fi +fi + +if test "${mongo_h_ok}" = "0" ; then + AC_MSG_ERROR([ + Could not locate bson.h on your machine to build the nsf mongo interface. + ]) +fi + +if test -z "${MONGO_LIB_DIR}" ; then + MONGO_LIB_SPEC="" +else + MONGO_LIB_SPEC="-L${MONGO_LIB_DIR}" +fi + +#echo "MONGO include spec = '${MONGO_INC_SPEC}'" +#echo "MONGO lib spec = '${MONGO_LIB_SPEC}'" + +#-------------------------------------------------------------------- +# Load the nsfConfig.sh file +#-------------------------------------------------------------------- + +AC_MSG_NOTICE([Reading file ${with_nsf}/nsfConfig.sh]) +source ${with_nsf}/nsfConfig.sh + +TEA_ADD_SOURCES([nsfmongo.c]) +TEA_ADD_HEADERS([]) +TEA_ADD_INCLUDES([-I${with_nsf}/generic ${NSF_BUILD_INCLUDE_SPEC} ${MONGO_INC_SPEC}]) +TEA_ADD_LIBS([$NSF_BUILD_STUB_LIB_SPEC $NSF_BUILD_LIB_SPEC $MONGO_LIB_SPEC -L/usr/local/src/mongo-c-driver -lmongoc -lbson]) +TEA_ADD_CFLAGS([]) +TEA_ADD_STUB_SOURCES([]) +TEA_ADD_TCL_SOURCES([]) + +#-------------------------------------------------------------------- +# __CHANGE__ +# A few miscellaneous platform-specific items: +# +# Define a special symbol for Windows (BUILD_sample in this case) so +# that we create the export library with the dll. +# +# Windows creates a few extra files that need to be cleaned up. +# You can add more files to clean if your extension creates any extra +# files. +# +# TEA_ADD_* any platform specific compiler/build info here. +#-------------------------------------------------------------------- + +if test "${TEA_PLATFORM}" = "windows" ; then + CLEANFILES="pkgIndex.tcl *.lib *.dll *.exp *.ilk *.pdb vc*.pch" + #TEA_ADD_SOURCES([win/winFile.c]) + #TEA_ADD_INCLUDES([-I\"$(${CYGPATH} ${srcdir}/win)\"]) +else + CLEANFILES="pkgIndex.tcl" + #TEA_ADD_SOURCES([unix/unixFile.c]) + #TEA_ADD_LIBS([-lsuperfly]) +fi +AC_SUBST(CLEANFILES) + +#-------------------------------------------------------------------- +# __CHANGE__ +# Choose which headers you need. Extension authors should try very +# hard to only rely on the Tcl public header files. Internal headers +# contain private data structures and are subject to change without +# notice. +# This MUST be called after TEA_LOAD_TCLCONFIG / TEA_LOAD_TKCONFIG +#-------------------------------------------------------------------- + +TEA_PUBLIC_TCL_HEADERS +#TEA_PRIVATE_TCL_HEADERS + +#TEA_PUBLIC_TK_HEADERS +#TEA_PRIVATE_TK_HEADERS +#TEA_PATH_X + +#-------------------------------------------------------------------- +# Check whether --enable-threads or --disable-threads was given. +#-------------------------------------------------------------------- + +TEA_ENABLE_THREADS + +#-------------------------------------------------------------------- +# The statement below defines a collection of symbols related to +# building as a shared library instead of a static library. +#-------------------------------------------------------------------- + +TEA_ENABLE_SHARED + +#-------------------------------------------------------------------- +# This macro figures out what flags to use with the compiler/linker +# when building shared/static debug/optimized objects. This information +# can be taken from the tclConfig.sh file, but this figures it all out. +#-------------------------------------------------------------------- + +TEA_CONFIG_CFLAGS + +#-------------------------------------------------------------------- +# Set the default compiler switches based on the --enable-symbols option. +#-------------------------------------------------------------------- + +TEA_ENABLE_SYMBOLS + +#-------------------------------------------------------------------- +# Everyone should be linking against the Tcl stub library. If you +# can't for some reason, remove this definition. If you aren't using +# stubs, you also need to modify the SHLIB_LD_LIBS setting below to +# link against the non-stubbed Tcl library. Add Tk too if necessary. +#-------------------------------------------------------------------- + +AC_DEFINE(USE_TCL_STUBS) +#AC_DEFINE(USE_TK_STUBS) + +#-------------------------------------------------------------------- +# This macro generates a line to use when building a library. It +# depends on values set by the TEA_ENABLE_SHARED, TEA_ENABLE_SYMBOLS, +# and TEA_LOAD_TCLCONFIG macros above. +#-------------------------------------------------------------------- + +TEA_MAKE_LIB + +#-------------------------------------------------------------------- +# Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl +# file during the install process. Don't run the TCLSH_PROG through +# ${CYGPATH} because it's being used directly by make. +# Require that we use a tclsh shell version 8.2 or later since earlier +# versions have bugs in the pkg_mkIndex routine. +# Add WISH as well if this is a Tk extension. +#-------------------------------------------------------------------- + +TEA_PROG_TCLSH +#TEA_PROG_WISH + +#-------------------------------------------------------------------- +# Finally, substitute all of the various values into the Makefile. +# You may alternatively have a special pkgIndex.tcl.in or other files +# which require substituting th AC variables in. Include these here. +#-------------------------------------------------------------------- + +AC_CONFIG_FILES([Makefile]) + +AC_OUTPUT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fisheye: Tag 42ba8471f7620b850b6296f753cbc3079fe5c6cd refers to a dead (removed) revision in file `library/mongodb/configure.in'. Fisheye: No comparison available. Pass `N' to diff? Index: library/mongodb/example-nx-reference-many.tcl =================================================================== diff -u -ra77464d1f7a06117c621560ec519dc4d387ed5df -r42ba8471f7620b850b6296f753cbc3079fe5c6cd --- library/mongodb/example-nx-reference-many.tcl (.../example-nx-reference-many.tcl) (revision a77464d1f7a06117c621560ec519dc4d387ed5df) +++ library/mongodb/example-nx-reference-many.tcl (.../example-nx-reference-many.tcl) (revision 42ba8471f7620b850b6296f753cbc3079fe5c6cd) @@ -28,7 +28,7 @@ # Retrieve the entry from the database: set g [Group find first -cond {name = "grp1"}] -puts stderr "Members of group: [$g members]\n" +puts stderr "Members of group: [$g cget -members]\n" ###################################################################### # The second approach to implement references to other objects via an @@ -52,11 +52,11 @@ # Retrieve the entry from the database: set g [Group find first -cond {name = "grp2"}] set members [list] -foreach m [Member find all -cond [list _id in [$g members]]] { +foreach m [Member find all -cond [list _id in [$g cget -members]]] { lappend members $m } -puts stderr "Members of group [$g name]:" -foreach m $members {puts stderr "\t[$m name]"} +puts stderr "Members of group [$g cget -name]:" +foreach m $members {puts stderr "\t[$m cget -name]"} puts stderr "" ###################################################################### @@ -81,8 +81,8 @@ # Retrieve the entry from the database: set g [Group find first -cond {name = "grp3"}] -puts stderr "Members of group [$g name]:" -foreach m [$g members] {puts stderr "\t[$m name]"} +puts stderr "Members of group [$g cget -name]:" +foreach m [$g cget -members] {puts stderr "\t[$m cget -name]"} puts stderr "" @@ -112,8 +112,8 @@ # Retrieve the entry from the database: set g [Group find first -cond {name = "grp4"}] - puts stderr "Members of group [$g name]:" - foreach m [$g members] {puts stderr "\t[$m name]"} + puts stderr "Members of group [$g cget -name]:" + foreach m [$g cget -members] {puts stderr "\t[$m cget -name]"} puts stderr "" puts stderr "Content of collection groups:" Index: library/mongodb/example-nx-reference-one.tcl =================================================================== diff -u -ra77464d1f7a06117c621560ec519dc4d387ed5df -r42ba8471f7620b850b6296f753cbc3079fe5c6cd --- library/mongodb/example-nx-reference-one.tcl (.../example-nx-reference-one.tcl) (revision a77464d1f7a06117c621560ec519dc4d387ed5df) +++ library/mongodb/example-nx-reference-one.tcl (.../example-nx-reference-one.tcl) (revision 42ba8471f7620b850b6296f753cbc3079fe5c6cd) @@ -30,7 +30,7 @@ # Retrieve the entry from the database: set p [Post find first -cond {title = "Hello trivial World"}] -puts stderr "Name of user: [$p user]\n" +puts stderr "Name of user: [$p cget -user]\n" ###################################################################### # The second approach to implement references to other objects via an @@ -54,8 +54,8 @@ # Retrieve the entry from the database: set p [Post find first -cond {title = "Hello simple World"}] -set u [User find first -cond [list _id = [$p user_id]]] -puts stderr "Name of user: [$u name]\n" +set u [User find first -cond [list _id = [$p cget -user_id]]] +puts stderr "Name of user: [$u cget -name]\n" ###################################################################### # The third approach is to embed the object in the referencing @@ -75,7 +75,7 @@ # Retrieve the entry from the database: set p [Post find first -cond {title = "Hello embedded World"}] -puts stderr "Name of user: [[$p user] name]\n" +puts stderr "Name of user: [[$p cget -user] cget -name]\n" ###################################################################### # The fourth approach is to use mongo db-refs for referencing. This @@ -101,7 +101,7 @@ # Retrieve the entry from the database: set p [Post find first -cond {title = "Hello referenced World"}] - puts stderr "Name of user: [[$p user] name]\n" + puts stderr "Name of user: [[$p cget -user] cget -name]\n" puts stderr "Content of the collection groups:" Post show Index: library/mongodb/mongoAPI.decls =================================================================== diff -u -r04b17cf850af721f6ad1760dece06ef78b11da83 -r42ba8471f7620b850b6296f753cbc3079fe5c6cd --- library/mongodb/mongoAPI.decls (.../mongoAPI.decls) (revision 04b17cf850af721f6ad1760dece06ef78b11da83) +++ library/mongodb/mongoAPI.decls (.../mongoAPI.decls) (revision 42ba8471f7620b850b6296f753cbc3079fe5c6cd) @@ -25,6 +25,7 @@ } cmd run NsfMongoRunCmd { + {-argName "-nocomplain" -required 0 -nrargs 0} {-argName "conn" -required 1 -type mongo} {-argName "db" -required 1} {-argName "cmd" -required 1 -type tclobj} Index: library/mongodb/mongoAPI.h =================================================================== diff -u -r04b17cf850af721f6ad1760dece06ef78b11da83 -r42ba8471f7620b850b6296f753cbc3079fe5c6cd --- library/mongodb/mongoAPI.h (.../mongoAPI.h) (revision 04b17cf850af721f6ad1760dece06ef78b11da83) +++ library/mongodb/mongoAPI.h (.../mongoAPI.h) (revision 42ba8471f7620b850b6296f753cbc3079fe5c6cd) @@ -71,7 +71,7 @@ static int NsfMongoInsert(Tcl_Interp *interp, mongo *connPtr, CONST char *namespace, Tcl_Obj *values); static int NsfMongoQuery(Tcl_Interp *interp, mongo *connPtr, CONST char *namespace, Tcl_Obj *query, Tcl_Obj *withAtts, int withLimit, int withSkip); static int NsfMongoRemove(Tcl_Interp *interp, mongo *connPtr, CONST char *namespace, Tcl_Obj *condition); -static int NsfMongoRunCmd(Tcl_Interp *interp, mongo *connPtr, CONST char *db, Tcl_Obj *cmd); +static int NsfMongoRunCmd(Tcl_Interp *interp, int withNocomplain, mongo *connPtr, CONST char *db, Tcl_Obj *cmd); static int NsfMongoUpdate(Tcl_Interp *interp, mongo *connPtr, CONST char *namespace, Tcl_Obj *cond, Tcl_Obj *values, int withUpsert, int withAll); enum { @@ -545,12 +545,13 @@ method_definitions[NsfMongoRunCmdIdx].paramDefs, method_definitions[NsfMongoRunCmdIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN, &pc) == TCL_OK)) { - mongo *connPtr = (mongo *)pc.clientData[0]; - CONST char *db = (CONST char *)pc.clientData[1]; - Tcl_Obj *cmd = (Tcl_Obj *)pc.clientData[2]; + int withNocomplain = (int )PTR2INT(pc.clientData[0]); + mongo *connPtr = (mongo *)pc.clientData[1]; + CONST char *db = (CONST char *)pc.clientData[2]; + Tcl_Obj *cmd = (Tcl_Obj *)pc.clientData[3]; assert(pc.status == 0); - return NsfMongoRunCmd(interp, connPtr, db, cmd); + return NsfMongoRunCmd(interp, withNocomplain, connPtr, db, cmd); } else { return TCL_ERROR; @@ -681,7 +682,8 @@ {"namespace", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"condition", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} }, -{"::mongo::run", NsfMongoRunCmdStub, 3, { +{"::mongo::run", NsfMongoRunCmdStub, 4, { + {"-nocomplain", 0, 0, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertToPointer, NULL,NULL,"mongo",NULL,NULL,NULL,NULL,NULL}, {"db", NSF_ARG_REQUIRED, 1, Nsf_ConvertToString, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, {"cmd", NSF_ARG_REQUIRED, 1, Nsf_ConvertToTclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}} Index: library/mongodb/nsfmongo.c =================================================================== diff -u -rd9214c77fc394b8a36f334d02432547a3904dea8 -r42ba8471f7620b850b6296f753cbc3079fe5c6cd --- library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision d9214c77fc394b8a36f334d02432547a3904dea8) +++ library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision 42ba8471f7620b850b6296f753cbc3079fe5c6cd) @@ -156,6 +156,8 @@ case BSON_BOOL: tag = "boolean"; elemObj = Tcl_NewBooleanObj(bson_iterator_bool( &i )); break; case BSON_REGEX: tag = "regex"; elemObj = Tcl_NewStringObj(bson_iterator_regex( &i ), -1); break; case BSON_STRING: tag = "string"; elemObj = Tcl_NewStringObj(bson_iterator_string( &i ), -1); break; + case BSON_MINKEY: tag = "minkey"; elemObj = Tcl_NewStringObj("null", 4); break; + case BSON_MAXKEY: tag = "maxkey"; elemObj = Tcl_NewStringObj("null", 4); break; case BSON_NULL: tag = "null"; elemObj = Tcl_NewStringObj("null", 4); break; case BSON_OID: { tag = "oid"; @@ -221,6 +223,10 @@ if (*(tag + 1) == 'o') /* double */ return BSON_DOUBLE; case 'i': /* integer */ return BSON_INT; case 'l': /* long */ return BSON_LONG; + case 'm': + if (*(tag + 1) == 'i') /* minkey */ return BSON_MINKEY; + if (*(tag + 1) == 'a') /* maxkey */ return BSON_MAXKEY; + break; case 'n': /* null */ return BSON_NULL; case 'o': if (*(tag + 1) == 'i') /* oid */ return BSON_OID; @@ -289,6 +295,12 @@ bson_append_long(bbPtr, name, v); break; } + case BSON_MAXKEY: + bson_append_maxkey(bbPtr, name); + break; + case BSON_MINKEY: + bson_append_minkey(bbPtr, name); + break; case BSON_NULL: { bson_append_null(bbPtr, name); break; @@ -538,13 +550,14 @@ /* cmd run NsfMongoRunCmd { + {-argName "-nocomplain" -required 0 -nrargs 0} {-argName "conn" -required 1 -type mongo} {-argName "db" -required 1} {-argName "cmd" -required 1 -type tclobj} } */ static int -NsfMongoRunCmd(Tcl_Interp *interp, mongo *connPtr, CONST char *db, Tcl_Obj *cmdObj) { +NsfMongoRunCmd(Tcl_Interp *interp, int withNocomplain, mongo *connPtr, CONST char *db, Tcl_Obj *cmdObj) { int result, objc; Tcl_Obj **objv; bson cmd[1], out[1]; @@ -559,11 +572,13 @@ result = mongo_run_command( connPtr, db, cmd, out ); bson_destroy( cmd ); - if (result != MONGO_OK) { - return NsfPrintError(interp, "mongo::run: provided command returned an unknown error"); + + if (withNocomplain == 0 && result != MONGO_OK) { + fprintf(stderr, "run result %d\n", result); + return NsfPrintError(interp, "mongo::run: command '%s' returned an unknown error", ObjStr(cmdObj)); } - Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); + Tcl_SetObjResult(interp, Tcl_NewIntObj(result == MONGO_OK)); return TCL_OK; } Index: library/mongodb/nx-mongo.tcl =================================================================== diff -u -ra77464d1f7a06117c621560ec519dc4d387ed5df -r42ba8471f7620b850b6296f753cbc3079fe5c6cd --- library/mongodb/nx-mongo.tcl (.../nx-mongo.tcl) (revision a77464d1f7a06117c621560ec519dc4d387ed5df) +++ library/mongodb/nx-mongo.tcl (.../nx-mongo.tcl) (revision 42ba8471f7620b850b6296f753cbc3079fe5c6cd) @@ -21,7 +21,7 @@ namespace eval ::nx::mongo { ::nx::Object create ::nx::mongo::db { - :property db + :object property db :public object method connect {{-db test} args} { set :db $db set :mongoConn [::mongo::connect {*}$args] @@ -32,7 +32,9 @@ :public object method remove {args} {::mongo::remove ${:mongoConn} {*}$args} :public object method query {args} {::mongo::query ${:mongoConn} {*}$args} :public object method update {args} {::mongo::update ${:mongoConn} {*}$args} - :public object method "drop collection" {name} {::mongo::run ${:mongoConn} ${:db} [list drop string $name]} + :public object method "drop collection" {name} {::mongo::run -nocomplain ${:mongoConn} ${:db} [list drop string $name]} + :public object method "drop database" {} {::mongo::run -nocomplain ${:mongoConn} ${:db} [list dropDatabase integer 1]} + :public object method "reset error" {} {::mongo::run -nocomplain ${:mongoConn} ${:db} [list reseterror integer 1]} } ####################################################################### @@ -121,7 +123,7 @@ puts stderr "autosave $value to obtain an object_id" $value save } - set _id [$value _id] + set _id [$value cget -_id] set cls [$value info class] return [list object [list \ {$ref} string [$cls mongo_collection] \ @@ -221,7 +223,7 @@ :method "get slot" {att} { set classes [concat [self] [:info mixin classes] [:info heritage]] foreach cls $classes { - set slot [$cls info slot objects $att] + set slot [$cls info slots $att] if {$slot ne ""} { return $slot } @@ -249,9 +251,9 @@ set slot [:get slot $att] if {$slot eq ""} {error "could not obtain slot for <$att $op $value>"} switch $op { - "=" {lappend bson $att [$slot mongotype] $value} + "=" {lappend bson $att [$slot cget -mongotype] $value} ">" - "<" - "<=" - ">=" - "!=" { - lappend bson $att object [list [:get relop $op] [$slot mongotype] $value] + lappend bson $att object [list [:get relop $op] [$slot cget -mongotype] $value] } "in" - "all" { lappend bson $att object [list [:get relop $op] {*}[$slot bson encode -array $value]] @@ -367,7 +369,7 @@ :public method insert {args} { set p [:new {*}$args] $p save - set _id [$p _id] + set _id [$p cget -_id] $p destroy return $_id } @@ -457,7 +459,7 @@ set :mongo_collection [string tolower [namespace tail [self]]]s } if {![info exists :mongo_db]} { - set :mongo_db [::nx::mongo::db db] + set :mongo_db [::nx::mongo::db cget -db] } set :mongo_ns ${:mongo_db}.${:mongo_collection} #puts stderr "mongo_ns is set to ${:mongo_ns}" @@ -555,7 +557,7 @@ } else { #puts "delete a non-embedded entry" if {[info exists :_id]} { - set mongo_ns [[:info class] mongo_ns] + set mongo_ns [[:info class] cget -mongo_ns] ::nx::mongo::db remove $mongo_ns [list _id oid ${:_id}] } else { error "[self]: object does not contain an _id; it can't be delete from the mongo db." @@ -568,7 +570,7 @@ # otherwise perform an insert # :public method save {} { - set mongo_ns [[:info class] mongo_ns] + set mongo_ns [[:info class] cget -mongo_ns] if {$mongo_ns eq ""} { # We could perform the delegation probably automatically, but # for now we provide an error Index: library/nx/nx.tcl =================================================================== diff -u -rb71082336b5d8539575db24d5b0ca620282d6bfd -r42ba8471f7620b850b6296f753cbc3079fe5c6cd --- library/nx/nx.tcl (.../nx.tcl) (revision b71082336b5d8539575db24d5b0ca620282d6bfd) +++ library/nx/nx.tcl (.../nx.tcl) (revision 42ba8471f7620b850b6296f753cbc3079fe5c6cd) @@ -334,11 +334,11 @@ # Class public method forward { - method + methodName -default -methodprefix -objframe:switch -onerror -returns -verbose:switch target:optional args } { - array set "" [:__resolve_method_path $method] + array set "" [:__resolve_method_path $methodName] set arguments [lrange [::nsf::current args] 1 end] if {[info exists returns]} { # search for "-returns" in the arguments before $args ... @@ -526,11 +526,11 @@ } :public method "object forward" { - method + methodName -default -methodprefix -objframe:switch -onerror -returns -verbose:switch target:optional args } { - array set "" [:__resolve_method_path -per-object $method] + array set "" [:__resolve_method_path -per-object $methodName] set arguments [lrange [::nsf::current args] 1 end] if {[info exists returns]} { # search for "-returns" in the arguments before $args ...