我正在使用此代码将特定文本查找到数据库中,然后我将使用 mojolicious 加载到页面中。这种方法好还是快?
use MongoDB;
use Data::Dump q(dump);
my $connection = MongoDB::Connection->new(host => 'localhost', port => 27017);
my $database = $connection->test;
my $col = $database->user;
my $r3 = $database->run_command([
"distinct" => "person",
"key" => "text",
"query" =>""
]);
for my $d ( @{ $r3->{values} } ) {
if ($d=~ /value/){
print "D: $d\n";
}
}