Interface between mongoDB and the Next Scripting Framework Ingredients: https://github.com/mongodb/mongo https://github.com/mongodb/mongo-c-driver The current version is tested with - MongoDB v2.6.1 - mongodb-c-driver 0.96 Compile or obtain mongodb (the database). 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 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/ 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/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 In order to run the sample script, * first start the mongdb (eg. mongod) * go to your nsf source directory * make sure, the c-driver libraries are on the library path (assuming the the c-driver was installed in /usr/local/lib) export DYLD_LIBRARY_PATH=/usr/local/lib:`pwd` * run ./nxsh library/mongodb/tests/nsf-mongo.test The script is using the low level interface (nsf::mongo) and has a few insert, query and delete statements, some of these are commented out. * run ./nxsh library/mongodb/example-nx-mongo.tcl This example script is using the higher level object oriented interface for nx (nx::mongo). After running this script, you should could check the content in MongoDB: % mongo MongoDB shell version: 2.6.1 connecting to: test > use tutorial switched to db tutorial > db.persons.find(); { "_id" : ObjectId("530c6e4649686ad16e261f81"), "name" : "Gustaf", "projects" : "nsf", "age" : 53 } { "_id" : ObjectId("530c6e4649686ad16e261f82"), "name" : "Stefan", "projects" : "nsf" } { "_id" : ObjectId("530c6e4649686ad16e261f83"), "name" : "Victor", "a" : [ "x", "y" ], "age" : 31 } { "_id" : ObjectId("530c6e4649686ad16e261f84"), "name" : "Joe", "projects" : "abc", "age" : 23, "classes" : [ DBRef("courses", ObjectId("100000000000000000000000")) ] } { "_id" : ObjectId("530c6e4649686ad16e261f85"), "name" : "Franz", "info" : { "x" : 203, "y" : 102 }, "age" : 29, "projects" : "gtat" } { "_id" : ObjectId("530c6e4649686ad16e261f86"), "name" : "Selim", "ts" : Timestamp(1302945037, 1), "d" : ISODate("2011-04-16T09:53:39.279Z") } > * Further sample-scripts: ./nxsh library/mongodb/tests/nx-bi.test ./nxsh library/mongodb/tests/nx-reference-one.test ./nxsh library/mongodb/tests/nx-reference-many.test ./nxsh library/mongodb/tests/nx-rep.test ./nxsh library/mongodb/tests/nx-serialize.test ./nxsh library/mongodb/tests/nsf-gridfs.test -gustaf neumann