Errata

We took great care to ensure that the content of the book are accurate. But despite our best efforts, mistakes happen. If you find any errors in the book, I’ll greatly appreciate that you report them in the Feedback section.

Here are the errors that have been found in the book and their corrections:

    1. Page 31 – array is constructed with curly braces, should be parenthesis instead.
    2. Page 116  – correct code for tag cloud generation
      ............................................
      case (50 <= $weight && $weight < 60):
      $tag['class'] = 'class6';
      break;
      case (60 <= $weight && $weight < 70):
      $tag['class'] = 'class7';
      break;
      case (70 <= $weight && $weight < 80):
      $tag['class'] = 'class8';
      break;
      case (80 <= $weight && $weight < 90):
      $tag['class'] = 'class9';
      break;
      case ($weight >= 90):
      $tag['class'] = 'class10';
      break;
    3. Page 132 – On the second line of code there is a missing single quote
      $request[viewed_at'] =
      should be
      $request['viewed_at'] =
    4. Page 134 – Wrong word choice in the first sentence of the second paragraph in the ‘Capped Collections’ section
      … unlike regular collections which are created implicitly.
      should be
      … unlike regular collections which can be created implicitly
    5. Page 140 – Typo in the second sentence in the first paragraph of the ‘Displaying the result’ section
      … and the counter and average response time in its values field: 
      should be
      … and the counter and average response time in its value field:
    6. Page 149 – Extra word in the fourth sentence of the ‘Storing entity metadata’ subsection
      … store some additional of information for … 
      should be
      … store some additional information for ..
    7. Page 161 – Line 19 of code in step 1, safe insert flag missing in the insert statement
      $collection->insert($record);
      should be
      $collection->insert($record, array('safe' => True));
    8. Page 170 – Third paragraph in ‘What just happened?’ section, magic methods (__get() and __set()) missing one underscore prefix each.
    9. Page 179 – The <h3> tag in line 22 of the code section is ended improperly.
    10. Page 206 – Typo in the comment on the 8th line of code
      //callback function for Ajax, marks each nearbu restaurant
      should be
      //callback function for Ajax, marks each nearby restaurant
    11. Page 227 – In section ‘Explaining queries using explain()’, the query should be performed on genre field and not on name field
      > db.movies.find({genre : 'action'}) .explain()
    12. Page 46 – In the code starting 5 lines from the bottom, there is a missing single quote mark before saved_at
      <?php print date('g:i a, F j', $article[saved_at']->sec;?> 
      should be
      <?php print date('g:i a, F j', $article['saved_at']->sec;?>