Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: error catching in mongodb and perl

by Loops (Curate)
on Nov 10, 2014 at 06:05 UTC ( #1106662=note: print w/replies, xml ) Need Help??


in reply to error catching in mongodb and perl

Hi there,

From the docs:

NOTE: MongoDB::Connection is DEPRECATED as of version 0.502.0 of the MongoDB CPAN distribution. It is no longer maintained and will be removed in a future version. Use MongoDB::MongoClient instead.

But having looked a little closer, the MongoDB::Tutorial is still using the Connection object rather than MongoClient. And doesn't show any error checking...

Replies are listed 'Best First'.
Re^2: error catching in mongodb and perl
by praveenchappa (Acolyte) on Nov 10, 2014 at 08:25 UTC

    i got an error while using MogoDB::MongoClient as below,i tried to install using cpan but its not istalling.

    use MongoDB; use JSON; use Data::Dumper; $client = MongoDB::MongoClient->new( host => 'remote_machine_ip:270 +17'); $client->connect; $client->authenticate('username', 'password', 'authenticationdb'); my $database = $client->get_database('prav'); my $collection = $database->get_collection( 'student'); my $data=$collection->find(); while (my $doc = $data->next) { my @qual=@{$doc->{'qualifications'}}; print @qual; print "\n"; } Can't locate object method "new" via package "MongoDB::MongoClient" (p +erhaps you forgot to load "MongoDB::MongoClient"?) at .. cpan MongoDB::MongoClient ---also tried cpan MongoDB .... .... Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible

      What was the error when trying to install MongoDB::MongoClient? That appears to be the crux of the matter.

      You must always remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.

        error while istalling MOngoClient

        In file included from bson/bson.h:23, from ./perl_mongo.h:22, from xs\BSON.xs:17: bson/bson-compat.h:96: error: expected '=', ',', ';', 'asm' or '__attr +ibute__' b efore 'INIT_ONCE' dmake.EXE: Error code 129, while making 'xs\BSON.o' MONGODB/MongoDB-v0.706.0.0.tar.gz C:\Dwimperl\c\bin\dmake.EXE -- NOT OK CPAN: YAML loaded ok (v0.77) Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1106662]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2022-05-22 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (81 votes). Check out past polls.

    Notices?