Guest User

Untitled

a guest
Nov 24th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. Fatal error: Uncaught Error: Call to undefined method MongoDBDriverCursor::skip() in /var/www/html/Tests/test_mongo_two/test.php:12 Stack trace: #0 {main} thrown in /var/www/html/Tests/test_mongo_two/test.php on line 12
  2.  
  3. <?php
  4.  
  5. require 'vendor/autoload.php';
  6. $connection = new MongoDBClient("mongodb://localhost:27017");
  7.  
  8.  
  9. $db = $connection->Traffic;
  10. $collection = $db->frameLengthsCollection;
  11.  
  12.  
  13. #$allDataCursor = $collection->find();
  14. $allDataCursor = $collection->find()->skip(25)->limit(25);
  15. #$allDataCursor = $allDataCursor->limit(25);
  16. #$allDataCursor = $allDataCursor->skip(25);
  17.  
  18.  
  19.  
  20.  
  21.  
  22. /**
  23. * Prettifying (is that a word?) of data
  24. */
  25. $allDataCursorConvertedToArray = array();
  26. foreach ($allDataCursor as $key => $value) {
  27. $json = MongoDBBSONtoJSON(MongoDBBSONfromPHP($value));
  28. $allDataCursorConvertedToArray[] = json_decode($json, true);
  29. }
  30.  
  31.  
  32.  
  33.  
  34. /**
  35. * Display!
  36. */
  37. #echo "allDataCursorConvertedToArray: "; print_r($allDataCursorConvertedToArray); echo "<br><br>";
  38. //
  39. foreach ($allDataCursorConvertedToArray as $key => $value) {
  40. print_r($value);
  41. break;
  42. }
  43.  
  44. ?>
Add Comment
Please, Sign In to add comment