Index: library/mongodb/Makefile.in =================================================================== diff -u -r2a955681817e4db4776d7ae904babe8053c5ad74 -rc1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83 --- library/mongodb/Makefile.in (.../Makefile.in) (revision 2a955681817e4db4776d7ae904babe8053c5ad74) +++ library/mongodb/Makefile.in (.../Makefile.in) (revision c1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83) @@ -310,7 +310,7 @@ (echo 'package ifneeded nsf::mongo $(PACKAGE_VERSION) \ [list load [file join $$dir $(PKG_LIB_FILE)]]'\ ) > pkgIndex.tcl - (echo 'package ifneeded nx::mongo 0.2 \ + (echo 'package ifneeded nx::mongo $(PACKAGE_VERSION) \ [list source [file join $$dir nx-mongo.tcl]]'\ ) >> pkgIndex.tcl Index: library/mongodb/README.md =================================================================== diff -u -rb9bcc40ab502329b1e7bc4ed6602adf7bd5e614d -rc1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83 --- library/mongodb/README.md (.../README.md) (revision b9bcc40ab502329b1e7bc4ed6602adf7bd5e614d) +++ library/mongodb/README.md (.../README.md) (revision c1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83) @@ -1,6 +1,7 @@ -# Interface between mongoDB and the Next Scripting Framework # +# Interface between MongoDB and the Next Scripting Framework # + This is an interface between MongoDB based on NSF (Next Scripting Framework) @@ -12,27 +13,28 @@ generate a C interface. -gustaf neumann March 27, 2011 +-stefan sobernig May 6, 2019 ## Ingredients: ## - https://github.com/mongodb/mongo - https://github.com/mongodb/mongo-c-driver + https://github.com/mongodb/mongo + https://github.com/mongodb/mongo-c-driver The current version of the NSF mongo binding is 2.2 and was tested with - Tcl 8.5, 8.6 and 8.7 -- MongoDB 3.6.6 (released July 10, 2018) -- mongodb-c-driver 1.12.0 (released July 18, 2018) -- libbson 1.12.0 (released July 18, 2018) +- MongoDB 4.0.9 (released April 16, 2019) +- mongodb-c-driver 1.14.0 (released February 22, 2019) +- libbson 1.14.0 (released February 22, 2019) Follow the following steps to get MongoDB up and running and to compile the MongoDB driver for NX. -## Obtain Mongodb and Mongo-C-Driver: ## +## Obtain MongoDB and Mongo-C-Driver: ## -- Compile or obtain mongodb (the database). +- Compile or obtain MongoDB (the database). - Compile or obtain the mongo-c-driver (client interface) @@ -70,15 +72,16 @@ "--disable-automatic-init-and-cleanup" is missing. -## Compiling the Mongo NSF Binding: ## +## Compiling the MongoDB NSF Binding: ## 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 +Configure the MongoDB NSF interface via the following command in the directory nsf*/library/mongodb/ + You will probably have to adjust the paths. ```` @@ -89,14 +92,22 @@ ```` In order to run the sample script, - * first start the mongodb (e.g. mongod) - * go to your NSF source directory - - * make sure, the c-driver libraries are on the library path + * first start the mongodb (e.g. mongod) + * go to your NSF source directory + * make sure, the c-driver libraries are on the library path (assuming the c-driver was installed in /usr/local/lib) +Linux: + ```` + export LD_LIBRARY_PATH=/usr/local/lib:`pwd` +```` + + +macOS: + +```` export DYLD_LIBRARY_PATH=/usr/local/lib:`pwd` ```` @@ -106,25 +117,17 @@ ./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 + The script is using both the low-level interface (nsf::mongo) and the + high-level one (nx::mongo), with each exercising a + few insert, query and delete statements, some of which are commented out. - * run + After running this script, you should check the content using the + MongoDB shell: ```` - ./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: v3.4.0 + MongoDB shell version: v4.0.9 connecting to: test > use tutorial switched to db tutorial @@ -135,7 +138,7 @@ { "_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") } - > + > quit() ```` ## Further sample-scripts: ## @@ -148,4 +151,3 @@ ./nxsh library/mongodb/tests/nx-serialize.test ./nxsh library/mongodb/tests/nsf-gridfs.test ```` - Index: library/mongodb/aclocal.m4 =================================================================== diff -u -re5837b2b6a65987c826cba577fc4cab810881375 -rc1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83 --- library/mongodb/aclocal.m4 (.../aclocal.m4) (revision e5837b2b6a65987c826cba577fc4cab810881375) +++ library/mongodb/aclocal.m4 (.../aclocal.m4) (revision c1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83) @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.14.1 -*- Autoconf -*- +# generated automatically by aclocal 1.16.1 -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, Index: library/mongodb/configure =================================================================== diff -u -rf7b560fcf16d625dfa38b9e9533f9014ba9a3ca7 -rc1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83 --- library/mongodb/configure (.../configure) (revision f7b560fcf16d625dfa38b9e9533f9014ba9a3ca7) +++ library/mongodb/configure (.../configure) (revision c1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for nsfmongo 2.3a0. +# Generated by GNU Autoconf 2.69 for nsfmongo 2.3. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -577,8 +577,8 @@ # Identity of this package. PACKAGE_NAME='nsfmongo' PACKAGE_TARNAME='nsfmongo' -PACKAGE_VERSION='2.3a0' -PACKAGE_STRING='nsfmongo 2.3a0' +PACKAGE_VERSION='2.3' +PACKAGE_STRING='nsfmongo 2.3' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1297,7 +1297,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures nsfmongo 2.3a0 to adapt to many kinds of systems. +\`configure' configures nsfmongo 2.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1358,7 +1358,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of nsfmongo 2.3a0:";; + short | recursive ) echo "Configuration of nsfmongo 2.3:";; esac cat <<\_ACEOF @@ -1471,7 +1471,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -nsfmongo configure 2.3a0 +nsfmongo configure 2.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1836,7 +1836,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by nsfmongo $as_me 2.3a0, which was +It was created by nsfmongo $as_me 2.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -9264,7 +9264,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by nsfmongo $as_me 2.3a0, which was +This file was extended by nsfmongo $as_me 2.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -9317,7 +9317,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -nsfmongo config.status 2.3a0 +nsfmongo config.status 2.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Index: library/mongodb/pkgIndex.add =================================================================== diff -u -rf7b560fcf16d625dfa38b9e9533f9014ba9a3ca7 -rc1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83 --- library/mongodb/pkgIndex.add (.../pkgIndex.add) (revision f7b560fcf16d625dfa38b9e9533f9014ba9a3ca7) +++ library/mongodb/pkgIndex.add (.../pkgIndex.add) (revision c1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83) @@ -1 +1 @@ -package ifneeded nsf::mongo 2.3a0 [list load [file join $dir libnsfmongo2.3a0.dylib]] +package ifneeded nsf::mongo 2.3 [list load [file join $dir libnsfmongo2.3.dylib]] Index: library/mongodb/tests/nsf-gridfs.test =================================================================== diff -u -rc4f449cb353be812ba6502ef8e9587e87881f59b -rc1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83 --- library/mongodb/tests/nsf-gridfs.test (.../nsf-gridfs.test) (revision c4f449cb353be812ba6502ef8e9587e87881f59b) +++ library/mongodb/tests/nsf-gridfs.test (.../nsf-gridfs.test) (revision c1f4cdc0b3367d4c0c2e69e4d983f45ed242fb83) @@ -34,7 +34,9 @@ ? {set gridFS [::mongo::gridfs::open $mongoConn myfs fs]} mongoc_gridfs_t:0 set dir [file dirname [file dirname [info script]]] -set fn README +set fn [glob -tails -directory $dir -- README*] +? {llength $fn} 1 + # gridfs::remove_file removes all files with the specified name # multiple store operations create "revisions" with different uploadDates ::mongo::gridfile::delete $gridFS [list filename string $fn] @@ -49,15 +51,15 @@ # # Store a known file: # -? {::mongo::gridfile::create -source file $gridFS $dir/$fn $fn text/plain} 1 +? {::mongo::gridfile::create -source file $gridFS [file join $dir $fn] $fn text/plain} 1 # # Open grid file, get some of its properties, and read it in chunks # of 1000 bytes, and close it finally. -? {set f [mongo::gridfile::open $gridFS {filename string README}]} mongoc_gridfs_file_t:0 +? {set f [mongo::gridfile::open $gridFS [list filename string $fn]]} mongoc_gridfs_file_t:0 ? {mongo::gridfile::get_metadata $f} "" -? {mongo::gridfile::get_contentlength $f} [file size $dir/README] +? {mongo::gridfile::get_contentlength $f} [file size [file join $dir $fn]] ? {mongo::gridfile::get_contenttype $f} text/plain ? { @@ -81,7 +83,7 @@ ? {llength [::mongo::collection::query $mongoColl {}]} 1 # store one more copy -? {::mongo::gridfile::create -source file $gridFS $dir/$fn $fn text/plain} 1 +? {::mongo::gridfile::create -source file $gridFS [file join $dir $fn] $fn text/plain} 1 # we should have now two entries: ? {llength [::mongo::collection::query $mongoColl {}]} 2 @@ -91,7 +93,7 @@ # Get the file named README from the gridfs via plain query interface # ? {set files [::mongo::collection::query $mongoColl \ - {filename string README} \ + [list filename string $fn] \ -opts { limit int64 1 }] llength [lindex $files 0] } 18