[SP-pm] Tratar funções como funções MongoDB

Daniel de Oliveira Mantovani daniel.oliveira.mantovani at gmail.com
Tue Jan 11 17:40:29 PST 2011


Detalhe, na documentação, logo no começo está:

    my $data       = $collection->find_one({ _id => $id });

Mas só falando com a mantedora o Gabriel descobriu que é,

    my $data       = $collection->find_one({ _id => $mong->oid($id) });

:)

Ele tem um patch no Github, mas ainda não subiu :P


2011/1/11 Daniel de Oliveira Mantovani <daniel.oliveira.mantovani em gmail.com>:
> Era isso mesmo,
> shonorio++
>
> O Gabriel Vieira, me ajudou pelo Google Talk e funcionou.
> (gabriel vieira)++ while 1;
>
> http://pastebin.com/xb4TSqwf
>
> 2011/1/11 Solli Honorio <shonorio em gmail.com>:
>> eu acho que vc precisa utilizar o MongoDB::OID
>>
>> Em 11 de janeiro de 2011 14:12, Daniel de Oliveira Mantovani
>> <daniel.oliveira.mantovani em gmail.com> escreveu:
>>>
>>> Pessoal, estou eu preciso fazer um find, usando o
>>> http://search.cpan.org/~kristina/MongoDB-0.40/lib/MongoDB.pm
>>>
>>> O find é equivalente a esse código, usando o Mongo cliente.
>>>
>>>  db.Foo.find({_id : ObjectId("4d2935a35a25524b32190000")})
>>>
>>> Porém, fazendo isso usando o API em Perl, ele trata o "ObjectId" como
>>> uma string.
>>> find({_id => "ObjectID(4d2a0fae9e0a3b4b32f70000"})
>>>
>>> Que é o equivalente a fazer isso no Mongo Cliente.
>>>  db.Foo.find({_id : "ObjectId(4d2935a35a25524b32190000)"})
>>>
>>> A pergunta é, como fazer o equivalente a isso no Mongo cliente:
>>>
>>>  db.Foo.find({_id : ObjectId("4d2935a35a25524b32190000")})
>>>
>>> usando Perl.
>>>
>>>
>>> http://stackoverflow.com/questions/4659437/how-to-use-find-to-seach-id-objectidid-in-perl-api
>>>
>>> --
>>> "If you’ve never written anything thoughtful, then you’ve never had
>>> any difficult, important, or interesting thoughts. That’s the secret:
>>> people who don’t write, are people who don’t think."
>>> =begin disclaimer
>>>   Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
>>>  SaoPaulo-pm mailing list: SaoPaulo-pm em pm.org
>>>  L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
>>> =end disclaimer
>>
>>
>>
>> --
>> "o animal satisfeito dorme". - Guimarães Rosa
>>
>> =begin disclaimer
>>   Sao Paulo Perl Mongers: http://sao-paulo.pm.org/
>>  SaoPaulo-pm mailing list: SaoPaulo-pm em pm.org
>>  L<http://mail.pm.org/mailman/listinfo/saopaulo-pm>
>> =end disclaimer
>>
>>
>
>
>
> --
> "If you’ve never written anything thoughtful, then you’ve never had
> any difficult, important, or interesting thoughts. That’s the secret:
> people who don’t write, are people who don’t think."
>



-- 
"If you’ve never written anything thoughtful, then you’ve never had
any difficult, important, or interesting thoughts. That’s the secret:
people who don’t write, are people who don’t think."


More information about the SaoPaulo-pm mailing list