diff --git a/testing/mongodb/APKBUILD b/testing/mongodb/APKBUILD
index 19558f35e6b1d665426a8d2ac00ad2a32c86f9ff..1d2301ee2ff6b68d34a7224aa362f495af083fb4 100644
--- a/testing/mongodb/APKBUILD
+++ b/testing/mongodb/APKBUILD
@@ -2,25 +2,25 @@
 # Contributor: Marc Vertes <marc.vertes@ugrid.net>
 pkgname=mongodb
 pkgver=3.2.10
-pkgrel=0
+pkgrel=1
 pkgdesc='A high-performance, open source, schema-free document-oriented database'
 url='http://www.mongodb.org'
 arch='x86_64'
 license='AGPL3'
 pkgusers="mongodb"
 depends=
-depends_dev="scons libressl-dev pcre-dev snappy-dev boost-dev asio-dev
+makedepends="scons paxmark libressl-dev pcre-dev snappy-dev boost-dev asio-dev
 	libpcap-dev wiredtiger-dev zlib-dev cyrus-sasl-dev yaml-cpp-dev"
-makedepends="$depends_dev"
 install="$pkgname.pre-install"
 source="http://downloads.mongodb.org/src/mongodb-src-r${pkgver}.tar.gz
 	20-fix-libc-version.patch
 	40-fix-elf-native-class.patch
 	backtrace.patch
 	fix-asio-strerror_r.patch
-	musl-available-stack.patch
+	set-default-stacksize.patch
 	wiredtiger-strtouq.patch
 	boost160.patch
+	boost162.patch
 
         mongodb.confd
         mongodb.initd
@@ -82,6 +82,9 @@ package() {
 	export SCONSFLAGS="$MAKEFLAGS"
 	scons $_buildopts --prefix=$pkgdir/usr install
 
+	# java jit requires paxmark
+	paxmark -m "$pkgdir"/usr/bin/mongo*
+
 	# install alpine specific files
 	install -dm700 "$pkgdir/var/lib/mongodb"
 	install -dm755 "$pkgdir/var/log/mongodb"
@@ -100,9 +103,10 @@ md5sums="a7ade13ff46add5544d285a04be24c22  mongodb-src-r3.2.10.tar.gz
 04a348397be8ca7471d404056d8a1490  40-fix-elf-native-class.patch
 86a988b5d4402227d177b8a1167008e8  backtrace.patch
 cd0833592e3a23e729ebd71eb756318c  fix-asio-strerror_r.patch
-a0e1d0ef5df415965a20a5da67d853c9  musl-available-stack.patch
+2d4de6cff2918ad610efead9f7c85f4f  set-default-stacksize.patch
 e6016216b02afd44164e17ae31e3ce7d  wiredtiger-strtouq.patch
 1df24dc2aa6b8f4c6da22f097a921ebb  boost160.patch
+79cfc7e792d1e8e30cc203a8c63ac65b  boost162.patch
 7d2f94bed7bfacd32fcd52dfd931f077  mongodb.confd
 792a0b53b3e843cf14176c5beb8cdfe1  mongodb.initd
 49df78833de4cb6e2b9b1ab9da52c3ac  mongodb.logrotate
@@ -113,9 +117,10 @@ sha256sums="3bef44f50f302159c26194bcac9d51c81d98d57ea728f55400774850a70f5120  mo
 3a863660113d29728d7a852b3fba73926697b496848f8ccc4d8e73e6614cfdfc  40-fix-elf-native-class.patch
 300d9f6b819730de54018d4b418eb7f921ba9c83fad4958a040544b076160848  backtrace.patch
 ec6d404221f02706ef2e52e00e414e98666dcc3606e78c9b3d33dfbd42a1eae7  fix-asio-strerror_r.patch
-68dba3180f0aedac2a3b9f868723552a2945882e53c9635e0d0585be9fd1e47b  musl-available-stack.patch
+85f2e5c5de90e43446ad3a13d661c211deb64cfce9e639ba1c2fa2a4573414ae  set-default-stacksize.patch
 20c465ae169e5e3642ca0c8486b2165a412dabe171e8e249c134e0a4688342a4  wiredtiger-strtouq.patch
 0e9da35f4303e53daf51e78961c517895f2d12f4fa49298f01e1665e15246d73  boost160.patch
+bf373d1514b7947dc4747e11babf87a4bd8e7d581781c6771a844e69c1c4d273  boost162.patch
 a4ca29c577428c02cd0b0a8b46756df5f53a05519c9d13c270533cf99b9b819d  mongodb.confd
 7e39fbd4dc18dba21c8767931683f4795e58e0e91b9f9a5842539923ded453c9  mongodb.initd
 76994c32d999def5c925bd7be3f96687b3406f1d67b89aa6a4df8053025b1e01  mongodb.logrotate
@@ -126,9 +131,10 @@ b9fdacb273d5a4e1e60735846b262287f84ca6cbded9393d182f69158d3162a50cae5d834f76860d
 56db8f43afc94713ac65b174189e2dd903b5e1eff0b65f1bdac159e52ad4de6606c449865d73bd47bffad6a8fc339777e2b11395596e9a476867d94a219c7925  40-fix-elf-native-class.patch
 7d097f497cb910c9cb81086cd8c222e43456d1a6de4adfe3e97a4d99add454279350fdeb7305dab84b3deca04afd824036d4065ee0fb8cdd8c03e96d98ee86af  backtrace.patch
 f829b1ad542db3ee776d444243b8b47ab4e48a7386d9b199d7b1adafd31556cf173a5683b78ee735d6a69999ad9af5ad152fde955bbe8865f7910718991ce97c  fix-asio-strerror_r.patch
-4251ad85c6a76cb5d87e7e1a3bb2f67c6abb046b3c145b86201310d89b43e99f3b4124da8a8df1f92dfcbcfc2187c14c14a85f48980cfd419ddb2e38508da071  musl-available-stack.patch
+1492137b0e3456d90a79617c1cd5ead5c71b1cfaae9ee41c75d56cd25f404ec73a690f95ce0d8c064c0a14206daca8070aa769b7cdfa904a338a425b52c293fa  set-default-stacksize.patch
 bbb323d428d59584703e8692bf4df7fe0d37c0324c23822bade2edd1ca78759191f778230b7107502a9d2f7f22afc84d4ea350139fc1d751ceb2fff219b9ddf8  wiredtiger-strtouq.patch
 385c82875174caae433a3b381eb10f98a6fed0c8943788ddefff1de80a898e480bdbbf094a7783285cf2ae11ce3fc6878e57d58183d05be2f0837b206aaa4da6  boost160.patch
+79edfd1a6eaba597b31a82e54722dccab288d8b8840a53f79140b5fca221b5acd9fbc770d99e46ea9fa0da502cdf18dd35d982c95a4aa341806c3d8b61fc732f  boost162.patch
 9bcd870742c31bf25f34188ddc3c414de1103e9860dea9f54eee276b89bc2cf1226abab1749c5cda6a6fb0880e541373754e5e83d63cc7189d4b9c274fd555c3  mongodb.confd
 2cb295ac0eb44acb4533c86d6d0988d5f760361a43cff7845713f3e2cf0e37023d23790a2926c613bf2b0668060c0b68d59000db52daaacd8af10e701a8b4192  mongodb.initd
 8c089b1a11f494e4148fb4646265964c925bf937633a65e395ee1361d42facf837871dd493a9a2e0f480ae0e0829dbd3ed60794c5334e2716332e131fc5c2c51  mongodb.logrotate
diff --git a/testing/mongodb/boost162.patch b/testing/mongodb/boost162.patch
new file mode 100644
index 0000000000000000000000000000000000000000..30a3bdff45f801434299ffb518e9918b8ea6a571
--- /dev/null
+++ b/testing/mongodb/boost162.patch
@@ -0,0 +1,15 @@
+Derived from http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/databases/mongodb/patches/patch-src_mongo_db_fts_unicode_string.cpp v1.1
+
+* Fix build with boost 1.62.0
+
+--- a/src/mongo/db/fts/unicode/string.cpp	2016-09-26 12:10:04.000000000 +0000
++++ b/src/mongo/db/fts/unicode/string.cpp
+@@ -274,7 +274,7 @@ bool String::substrMatch(const std::stri
+ 
+     // Case sensitive and diacritic sensitive.
+     return boost::algorithm::boyer_moore_search(
+-               haystack.begin(), haystack.end(), needle.begin(), needle.end()) != haystack.end();
++               haystack.begin(), haystack.end(), needle.begin(), needle.end()) != std::make_pair(haystack.end(), haystack.end());
+ }
+ 
+ }  // namespace unicode
diff --git a/testing/mongodb/musl-available-stack.patch b/testing/mongodb/musl-available-stack.patch
deleted file mode 100644
index 4774b6210aa6decaf3a9ad13ba6b83d99e7b9a8e..0000000000000000000000000000000000000000
--- a/testing/mongodb/musl-available-stack.patch
+++ /dev/null
@@ -1,17 +0,0 @@
---- mongodb-src-r3.2.1/src/mongo/scripting/mozjs/implscope.cpp.orig
-+++ mongodb-src-r3.2.1/src/mongo/scripting/mozjs/implscope.cpp
-@@ -258,7 +258,13 @@
-             //
-             // TODO: What if we are running on a platform with very
-             // large pages, like 4MB?
--            JS_SetNativeStackQuota(_runtime, available.get() - (64 * 1024));
-+            //JS_SetNativeStackQuota(_runtime, available.get() - (64 * 1024));
-+
-+            // For musl libc: We adjust the reserved quota to 32k instead of
-+            // 64k because the default musl libc thread stack size is small
-+            // (80k) and we can not set stack size for C++ threads.
-+            // Note also that with musl, stack size does not include guard page.
-+            JS_SetNativeStackQuota(_runtime, available.get() - (32 * 1024));
-         }
- 
-         // The memory limit is in megabytes
diff --git a/testing/mongodb/set-default-stacksize.patch b/testing/mongodb/set-default-stacksize.patch
new file mode 100644
index 0000000000000000000000000000000000000000..d40a2d4b6e803baceb7fe31a3131f3aabf8407da
--- /dev/null
+++ b/testing/mongodb/set-default-stacksize.patch
@@ -0,0 +1,20 @@
+diff -ru mongodb-src-r3.2.10.orig/src/mongo/platform/stack_locator_pthread_getattr_np.cpp mongodb-src-r3.2.10/src/mongo/platform/stack_locator_pthread_getattr_np.cpp
+--- mongodb-src-r3.2.10.orig/src/mongo/platform/stack_locator_pthread_getattr_np.cpp	2016-09-26 15:10:04.000000000 +0300
++++ mongodb-src-r3.2.10/src/mongo/platform/stack_locator_pthread_getattr_np.cpp	2016-11-01 10:47:31.062284560 +0200
+@@ -35,6 +35,16 @@
+ #include "mongo/util/assert_util.h"
+ #include "mongo/util/scopeguard.h"
+ 
++__attribute__((constructor))
++static void set_default_stack_size(void)
++{
++    pthread_attr_t attr;
++    invariant(pthread_attr_init(&attr) == 0);
++    invariant(pthread_attr_setstacksize(&attr, 256*1024) == 0);
++    pthread_setattr_default_np(&attr);
++    invariant(pthread_attr_destroy(&attr) == 0);
++}
++
+ namespace mongo {
+ 
+ StackLocator::StackLocator() {