Skip to content
Snippets Groups Projects
Commit c161b221 authored by Gerhard Gonter's avatar Gerhard Gonter :speech_balloon:
Browse files

dirty hack do deal with various version of MongoDB driver

parent c59be8a1
No related branches found
No related tags found
No related merge requests found
......@@ -172,6 +172,19 @@ my $objreg= new TA::ObjReg ('project' => $project, 'store' => $store, 'key' => '
# print "objreg: ", Dumper ($objreg); exit;
&usage ('no config found') unless (defined ($objreg));
print "objreg: ", Dumper ($objreg) if ($DEBUG || $STOP);
if (!defined (&MongoDB::Collection::remove) && defined (&MongoDB::Collection::delete_one))
{ # this is bad; the script has to run with MongoDB drivers with versions ranging from 0.702.1 over v1.2.2 to v2.0.1;
# 0.702.1 does not have delete_one(), v1.2.2 deprecated remove() and v2.0.1 does no longer have remove()
print "MongoDB remove() missing; patching...\n";
*MongoDB::Collection::remove= *MongoDB::Collection::delete_one;
}
unless (defined (&MongoDB::Collection::remove))
{
die("MongoDB remove() missing");
}
exit(2) if ($STOP);
$SIG{INT}= sub { $STOP= 1; print "SIGINT received\n"; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment