Index: library/mongodb/nsfmongo.c =================================================================== diff -u -N -rbfc9f64e6e94f265a27a32d5f7faf0763ae1c9e3 -r5c3834b15078b31970db26d0c65030ed1f66b18d --- library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision bfc9f64e6e94f265a27a32d5f7faf0763ae1c9e3) +++ library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision 5c3834b15078b31970db26d0c65030ed1f66b18d) @@ -670,7 +670,7 @@ /* TODO: examples in mongo-client do not touch out; do we have to do something about it? */ - Tcl_SetObjResult(interp, Tcl_NewBooleanObj(success)); + Tcl_SetObjResult(interp, Tcl_NewBooleanObj(success == MONGO_OK)); return TCL_OK; } @@ -821,7 +821,7 @@ static int NsfMongoUpdate(Tcl_Interp *interp, mongo *connPtr, CONST char *namespace, Tcl_Obj *conditionObj, Tcl_Obj *valuesObj, int withUpsert, int withAll) { - int objc, result, options = 0; + int objc, result, mongorc, options = 0; Tcl_Obj **objv; bson cond[1], values[1]; @@ -844,8 +844,10 @@ if (withAll) {options |= 2;} /* for the time being, no write_concern (last arg of mongo_update()) */ - mongo_update(connPtr, namespace, cond, values, options, NULL); - + mongorc = mongo_update(connPtr, namespace, cond, values, options, NULL); + + Tcl_SetObjResult(interp, Tcl_NewBooleanObj(mongorc == MONGO_OK)); + return TCL_OK; }