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

Daniel de Oliveira Mantovani daniel.oliveira.mantovani at gmail.com
Tue Jan 11 08:12:10 PST 2011


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."


More information about the SaoPaulo-pm mailing list