Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the MongoDB CPAN distribution.

Maintainer(s)' notes

Please don't report bugs here. Please use the MongoDB Perl driver issue tracker instead.

Report information
The Basics
Id: 78461
Status: resolved
Priority: 0/
Queue: MongoDB

People
Owner: Nobody in particular
Requestors: ashleyw [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 0.44
  • 0.45
Fixed in: (no value)



Subject: update() does not die where insert() does
My program dies with the following message: inserts cannot contain the . character at /home/awillis/perl5/perlbrew/perls/perl-5.12.4/lib/site_perl/5.12.4/x86_64-linux/MongoDB/Collection.pm line 296. But it is successful when doing an update, incluing an upsert: Show quoted text
> db.users.find()
{ "_id" : ObjectId("500827bb7682ea6dbf806ed2"), "ashleyw@example.com" : "ashley willis", "USERNAME" : "ashleyw" } Example program is attached. Disabling strict/warnings/{safe => 1} has no effect. My understanding is that it should die in all cases.
Subject: mongobug.pl
#!/usr/bin/perl use strict; use warnings; use MongoDB; use MongoDB::OID; my $conn = MongoDB::Connection->new; my $db = $conn->tutorial; my $users = $db->users; my $id = $users->update({'USERNAME' => 'ashley'}, {'ashley@example.com' => 'ashley willis', 'USERNAME' => 'ashley'}, {upsert => 1, safe => 1}); print "ID $id\n"; my $id = $users->update({'USERNAME' => 'ashley'}, {'ashleyw@example.com' => 'ashley willis', 'USERNAME' => 'ashleyw'}, {safe => 1}); print "ID $id\n"; $id = $users->insert({'ashleywillis@example.com' => 'ashley willis', 'USERNAME' => 'ashleywillis'}, {safe => 1}); # dies: inserts cannot contain the . character at /home/awillis/perl5/perlbrew/perls/perl-5.12.4/lib/site_perl/5.12.4/x86_64-linux/MongoDB/Collection.pm line 296. print "ID $id\n";
You are correct, the driver should check for that. On Thu Jul 19 11:44:11 2012, ASHLEYW wrote: Show quoted text
> My program dies with the following message: > inserts cannot contain the . character at > /home/awillis/perl5/perlbrew/perls/perl- > 5.12.4/lib/site_perl/5.12.4/x86_64-linux/MongoDB/Collection.pm > line 296. > > But it is successful when doing an update, incluing an upsert:
> > db.users.find()
> { "_id" : ObjectId("500827bb7682ea6dbf806ed2"), "ashleyw@example.com" > : > "ashley willis", "USERNAME" : "ashleyw" } > > Example program is attached. Disabling strict/warnings/{safe => 1} has > no effect. My understanding is that it should die in all cases.
This has been migrated to the official JIRA tracker as https://jira.mongodb.org/browse/PERL-333