Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-- Initialize MongoDB
- print "Initializing MongoDB...\n";
- my $conn = MongoDB::Connection->new(host => 'localhost');
- print "MongoDB connection established\n";
- my $db = $conn->get_database(MONGO_LOG_DB);
- print "Using ".MONGO_LOG_DB." database\n";
- my $collection = $db->get_collection(MONGO_LOG_COLL);
- print "Obtained the ".MONGO_LOG_COLL." collection\n\n";
- my $cursor = $collection->find->tailable(1);
- if (defined(my $doc = $cursor->next)) { print "Defined!\n"; }
- else { print "Not Defined!\n"; }
Add Comment
Please, Sign In to add comment