标题: 关于perl连接 mongodb出现的错误 [打印本页] 作者: dolinux 时间: 2012-05-22 20:27 标题: 关于perl连接 mongodb出现的错误 在测试使用perl连接mongodb的时候测试最简单的例子:
#!/usr/bin/perl -w
use MongoDB;
use Data:umper;
my $connection = MongoDB::Connection->new(host => 'localhost', port => 1105);
my $database = $connection->test;
my $collection = $database->foo;
my $id = $collection->insert({ some => 'data' });
my $data = $collection->find_one();
print Dumper($data);
执行后返回结果是:
Can't locate object method "run_command" via package "MongoDB:atabase" at /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi/MongoDB/Connection.pm line 519.