简体   繁体   English

Perl和MongoDB更新问题

[英]Perl and MongoDB update issue

i tried to use https://metacpan.org/release/MongoDB module over perl and found a small bug or i haven't enough material on doc 我试图在Perl上使用https://metacpan.org/release/MongoDB模块,发现一个小错误,或者我在doc上没有足够的资料

this is where i got error 这是我出错的地方

{ "_id" : ObjectId("4f625c0fcd4481bc13000000"), "mode" : "running", "res" : "running", "custid":NumberLong(155655062)}

db.movie.update({custid:NumberLong(155655062)},{'$set':{mode:"testing"}});

I am able to update the thing here but not able to update from perl code. 我可以在这里更新内容,但不能从Perl代码更新。

my $res = $db->movie->update({'custid'=>'NumberLong(155655062)'},{'$set' => { 'mode' => 'testing' }});

did i miss any code in the above example 我是否错过了上面示例中的任何代码

my $cust_id = 155655062; OR my $cust_id = int($record->{custid});
my $res = $db->movie->update({'custid'=>$cust_id},{'$set' => { 'mode' => 'testing' }});

Try this, it should work. 试试这个,它应该起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM