Index: library/mongodb/README =================================================================== diff -u -r4bfd06fe844a57be4044b937148037a88baeed17 -rb442bd44789582101fc502585f8db806cbc61ed8 --- library/mongodb/README (.../README) (revision 4bfd06fe844a57be4044b937148037a88baeed17) +++ library/mongodb/README (.../README) (revision b442bd44789582101fc502585f8db806cbc61ed8) @@ -9,38 +9,36 @@ The current version is tested with - MongoDB v2.4.9 - mongodb-c-driver 0.90.1 -- libbson 0.4.3 Compile or obtain mongodb (the database). -Compile or obtain libbson (binary json library) - - cd /usr/local/src - git clone https://github.com/mongodb/libbson - cd libbson - sh autogen.sh - make - sudo make install - Compile or obtain the mongo-c-driver (client interface) cd /usr/local/src git clone https://github.com/mongodb/mongo-c-driver cd mongo-c-driver - export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + sh autogen.sh make sudo make install +If you experience errors during autogen on debian, you might have to + apt-get install libtool + +If configure complains about not finding bson, you might have to do + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + + Assume the following installation directories + - Tcl: /usr/local/ns/lib/ - mongo-c-driver: /usr/local/src/mongo-c-driver/ - - libbson: /usr/local/src/libbson + configure the mongodb nsf interface via the following command in the directory nsf*/library/mongodb/ ./configure --with-tcl=/usr/local/ns/lib/ --with-nsf=../../ \ - --with-mongoc=/usr/local/src/mongo-c-driver/mongoc/,/usr/local/src/mongo-c-driver/.libs \ - --with-bson=/usr/local/src/libbson/src/bson,/usr/local/src/libbson/.libs \ + --with-mongoc=/usr/local/src/mongo-c-driver/src/mongoc/,/usr/local/src/mongo-c-driver/.libs \ + --with-bson=/usr/local/src/mongo-c-driver/src/libbson/src/bson \ --enable-threads --enable-symbols --prefix=/usr/local/ns Index: library/mongodb/nsfmongo.c =================================================================== diff -u -r4bfd06fe844a57be4044b937148037a88baeed17 -rb442bd44789582101fc502585f8db806cbc61ed8 --- library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision 4bfd06fe844a57be4044b937148037a88baeed17) +++ library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision b442bd44789582101fc502585f8db806cbc61ed8) @@ -1141,13 +1141,31 @@ * Currently we need a few private gridfs functions since the new * c-driver has less functionality than the old one. ***********************************************************************/ +#define MONGO_HAS_NO_GRIDFS_COLLECTION_ACCESSOR 1 +#if defined(MONGO_HAS_NO_GRIDFS_COLLECTION_ACCESSOR) #define MONGOC_INSIDE 1 #include "mongoc-gridfs-private.h" -#include "mongoc-gridfs-file-private.h" #undef MONGOC_INSIDE + +mongoc_collection_t * +mongoc_gridfs_get_files (mongoc_gridfs_t * gridfs) +{ + return gridfs->files; +} + +mongoc_collection_t * +mongoc_gridfs_get_chunks (mongoc_gridfs_t * gridfs) +{ + return gridfs->chunks; +} +#endif + + + #define MONGOC_GRIDFS_READ_CHUNK 4096*4 + /* cmd gridfile::create NsfMongoGridFileCreate { {-argName "-source" -required 1 -typeName "gridfilesource" -type "file|string"} @@ -1260,7 +1278,7 @@ } BsonAppendObjv(interp, query, objc, objv); - files = mongoc_collection_find( gridfsPtr->files, 0, + files = mongoc_collection_find( mongoc_gridfs_get_files(gridfsPtr), 0, 0, 0, 0 /* batch_size */, query, NULL, NULL); bson_destroy(query); @@ -1278,13 +1296,13 @@ /* Remove the file with the specified id */ bson_init(b); bson_append_oid(b, "_id", 3, &id); - mongoc_collection_delete(gridfsPtr->files, 0, b, NULL, &bsonError); + mongoc_collection_delete(mongoc_gridfs_get_files(gridfsPtr), 0, b, NULL, &bsonError); bson_destroy(b); /* Remove all chunks from the file with the specified id */ bson_init(b); bson_append_oid(b, "files_id", 8, &id); - mongoc_collection_delete(gridfsPtr->chunks, 0, b, NULL, &bsonError); + mongoc_collection_delete(mongoc_gridfs_get_chunks(gridfsPtr), 0, b, NULL, &bsonError); bson_destroy(b); } @@ -1382,22 +1400,12 @@ static int NsfMongoGridFileGetContentType(Tcl_Interp *interp, mongoc_gridfs_file_t* gridFilePtr) { - Tcl_SetObjResult(interp, Tcl_NewStringObj(gridFilePtr->bson_content_type, -1)); + Tcl_SetObjResult(interp, Tcl_NewStringObj(mongoc_gridfs_file_get_content_type(gridFilePtr), -1)); return TCL_OK; } -#if 0 -bson_t * -mongoc_gridfs_file_get_metadata(mongoc_gridfs_file_t *file) { - return &file->bson_metadata; -} -void -mongoc_gridfs_file_set_metadata(mongoc_gridfs_file_t *file, bson_t *metadata) { - file->bson_metadata = *metadata; -} -#endif /* cmd gridfile::get_metadata NsfMongoGridFileGetMetaData {