Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $username = 'mongodbusername';
- $password = 'changeMe';
- $m = new MongoClient("mongodb://myadmin1:myadmin123@localhost/dbname");
- //$m = new MongoClient("mongodb://localhost", array("username" => $username, "password" => $password,"db" => "jobma_integrations"));
- $db = $m->integrations; // this is your dbname
- $crawlingCollection = $db->crawled_jobs; // this is your collection name
- $c = $crawlingCollection->find(
- ['$text' => ['$search' => "sales "ardmore""]], // this "ardmore" is used for exact match and sales will be match with any where
- ['score'=> ['$meta'=>'textScore']]
- )->sort(
- ['score'=> ['$meta'=>'textScore']]
- );
- echo "<pre>";
- var_dump(iterator_to_array($c));
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement