http://www.perlmonks.org?node_id=963916

Kanishka.black0 has asked for the wisdom of the Perl Monks concerning the following question:

my $list = $userinfo->userinfo->find({ user => $uid },{ user => 1});
i tried to grab data from the mongodb, this should get only the user object from the collection
but it is getting even other items from the object

Replies are listed 'Best First'.
Re: Perl and MongoDB find error
by Anonymous Monk on Apr 08, 2012 at 03:58 UTC

    this should get only the user object from the collection

    Why? You specify two users ... Maybe you'd like to use find_one?

      it seems that mongodb "find" doesn't support query for fields, i though its would support them as in "find_one"

        it seems that mongodb "find" doesn't support query for fields, i though its would support them as in "find_one"

        It doesn't seem that way to me. See MongoDB::Examples