Guest User

Untitled

a guest
Aug 8th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.52 KB | None | 0 0
  1.     #-- Initialize MongoDB
  2.     print "Initializing MongoDB...\n";
  3.  
  4.     my $conn = MongoDB::Connection->new(host => 'localhost');  
  5.     print "MongoDB connection established\n";
  6.  
  7.     my $db = $conn->get_database(MONGO_LOG_DB);
  8.     print "Using ".MONGO_LOG_DB." database\n"; 
  9.  
  10.     my $collection = $db->get_collection(MONGO_LOG_COLL);
  11.     print "Obtained the ".MONGO_LOG_COLL." collection\n\n";
  12.  
  13.     my $cursor = $collection->find->tailable(1);
  14.  
  15.     if (defined(my $doc = $cursor->next)) { print "Defined!\n"; }
  16.     else { print "Not Defined!\n"; }
Add Comment
Please, Sign In to add comment