Errata

MongoDB: The Definitive Guide

Errata for MongoDB: The Definitive Guide

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Chapter 8. Transactions core API Python Listing

core API Python Listing Step 1 inside function update_orders_and_inventory(my_session):

orders = session.client.webshop.orders
inventory = session.client.webshop.inventory

where does session come from?

Maybe please include the import statements (in all listings) so everyone can follow what is behind what!

or is this a mistake and it should be:
orders = my_session.client.webshop.orders
inventory = my_session.client.webshop.inventory

Anonymous  Dec 15, 2019 
Chapter 5. "Explain output" paragraph.

Hi, I guess this paragraph of chapter 5 is wrong.

The output of an explain on a query that uses an index varies, but in the simplest case it looks something like this if we add an index on imdb.rating:

Because we are not using any imdb database as example.

I hope you find this useful. Best regards.

Julio Jordan  Jan 14, 2020 
N/A
Figure 7-4

The figure 7-4 describing $unwind shows the last resulting object as {key1: "value1", key2: "value2", key3: ["elem3"}. The "[" before "elem3" is invalid json and probably a typo.

Anonymous  Aug 04, 2020 
section 7
text

A customer pointed out that they think there is missing example codes from some sections (ie. section 7 "Introduction to the Aggregation Framework") that are not included in the examples repo (https://github.com/mongodb-the-definitive-guide-3e/mongodb-the-definitive-guide-3e)

Could this be reviewed and amended as needed?

Anonymous  Jan 05, 2021 
ePub Page 9
2

Not clear

Anonymous  Apr 28, 2021 
Printed Page 21
3rd paragraph

The alignment of labels following the sentence "The 12 bytes of an ObjectId are generated as follows", suggests that byte 0 is a Timestamp, byte 1 is Random, and byte 2 is Counter (random start value).

This contradicts the following sections, when it says four bytes are used, as does the Mongo manual. https://docs.mongodb.com/manual/reference/bson-types/#objectid

My guess, is that bytes 0-3 are timestamp, 4-8 are random, and 9-11 are a counter, but that is just a _guess_.

Steve Ramage  Jun 20, 2020 
Printed Page 29
Last item in first paragraph

The last item promises a section about "Choosing the correct level of safety vs speed". I assume this was supposed to mention the different levels of the option "writeConcern". This section is however missing; probably the discussion is deferred to another chapter, and the item remained.

Note: this is also mentioned in the short description of the chapter 3 in the preface of the book

Anonymous  Jun 28, 2020 
Printed, Page 50
code sample at bottom of page

Problem line of code:
while ((ps = cursor.next()) != null) {

At end of data, the method cursor.next() does not return null, it throws an exception.

Replace with:

while (cursor.hasNext())
{
let ps = cursor.next();

David Lonergan  Feb 20, 2020 
PDF Page 51
3rd paragraph

The example code showing the use of "returnNewDocument" is missing "{".

db.processes.findOneAndUpdate(
...,
{"returnNewDocument": true})

Anonymous  Apr 21, 2023 
PDF Page 62
1st paragraph of "Array and range query interactions"

Original text: However, if a document’s "x" field is an array, the document matches if there is an element of "x" that matches each part of the criteria, ...

Should be: However, if a document’s "x" field is an array, the document matches if there is a part of the criteria that matches each element of "x", ...

Anonymous  Feb 09, 2022 
Printed Page 117 and 119
on page 117 right above the example (last word), on page 119 first sentence

On page 117 and 119 the wrong example database and collection is used (imdb.rating instead of db.users). The text refers to imdb.rating (page 117 last word right above the example and page 119 first sentence underneath the example) while I think it should be db.users.

Jurek De Vrij  Sep 12, 2020 
Printed Page 120
Last paragraph

The text mentions two example indices, {"username": 1, "age": 1} and {"age": 1, "username": 1} . The indices used to generate the output in the following pages however, are {"username": 1} and {"age": 1, "username": 1}.

Anonymous  Aug 01, 2020 
Printed Page 125
2nd paragraph

"30% or more" should be "30% or less".

An index is more effective if the returned resultset is a smaller fraction of the total amount of documents, so when the result set contains 30% or less of the collection the query is more likely to benefit from the index.

Anonymous  Aug 01, 2020 
Printed Page 126
2nd paragraph, 3rd line

"username" should be "firstname"

The index in the output below is enforces a unique first name, not a unique username.

Anonymous  Aug 01, 2020 
Printed, ePub Page 131
Chapter 5 "Changing Indexes" paragraph the last sentence

Hi, the last sentence of Chapter 5 "Changing Indexes" paragraph is "There is more on the operational aspects of building indexes in
Chapter 19." But, I can't find anything about index in the Chapter 19. Please help me.

Jamie  Jul 04, 2020 
Printed Page 134
3rd example (GeoJson polygon example)

The coordinates for the polygon should be surrounded by an extra pair of square brackets. Furthermore, it is only valid GeoJson if the last coordinate in the polygon specification is the same as the first:
[[[0,1], [0,2], [1,2], [0,1]]]

Anonymous  Aug 01, 2020 
Printed, Page 229
mongod commands at the top

Option --smallfiles is not supported in mongo 4.2

David Lonergan  Mar 08, 2020 
Printed Page 229
2nd paragraph in section "Networking Considerations”

Example IP should start with 192 instead of 198, as is stated correctly in the command below.

Anonymous  Sep 06, 2020 
Printed Page 255
2nd paragraph under "Elections"

The text reads, "If it did not receive a majority if votes..."

"if" should be "of"

Dean Ganskop  Feb 19, 2024 
Printed Page 265
Section ”Other options ...”

"n+ 1” misses a space

Anonymous  Sep 06, 2020 
Printed Page 278
item "self"

The server that claims to be "self" is server-1, and not server-2

Anonymous  Sep 27, 2020 
Printed Page 278
item "errMsg"

The description claims that this field is shown in the output of server-3, but it is not.

Anonymous  Sep 27, 2020 
Printed Page 292
1st paragraph

"Shard as a three-node replica set" is repeated

Anonymous  Oct 03, 2020 
Printed Page 292
1st paragraph

There's repeated text:

"rs defines each shard as a three-node replica set with an oplogSize of 10 MiB (again, to keep resource shard as a three-node replica set with an oplogSize of 10 MiB (again, to keep resource utilization low)"

Dean Ganskop  Feb 19, 2024 
Other Digital Version 304 of 1426
The example code after the "We can also leverage all of the standard JavaScript libraries:"

Specific Digital Version: Amazon Kindle eBook Free Sample

On Chapter 2 - Getting Started, on the section "Introduction to the MongoDB Shell" under the subsection "Running the Shell":

One of the example codes have the following typo on the date string:

> new Date("20109/1/1")
ISODate("2019-01-01T05:00:00Z")

The example code should be corrected to the following instead:

> new Date("2019/1/1")
ISODate("2019-01-01T05:00:00Z")

Emmanuel Cagadas  Apr 02, 2020 
Printed Page 304
1st paragraph under "Config Servers

The last sentence in the paragraph reads, "Each config server should be on a separate physical machine, preferable geographically distributed."

"preferable" should be "preferably".

Dean Ganskop  Feb 19, 2024 
Printed Page 310
Sharding Data Paragraph

The comand to enable sharding on a single db should be :

sh.enableSharding("DB_NAME")

As reported : db.enableSharding("musci")

Anonymous  Jul 01, 2020 
Printed Page 316
5th paragraph

The first sentence in the paragraph reads, "An application using the cluster does not need be aware..."

It should read, "does not need to be aware..."

Dean Ganskop  Feb 19, 2024 
Printed Page 409
3rd paragraph

The first sentence reads, "In the same fashion, with write concerns you will need to weight the performance impacts of the read concerns..."

"weight" should be "weigh".

Dean Ganskop  Feb 19, 2024 
Printed Page 427
2nd paragraph

This paragraph is a repetition of the 5th paragraph page 426

Anonymous  Oct 31, 2020 
Printed Page 431
4th paragraph, first line

Linebreak in the work WiredTiger is "Wire-dTiger" instead of "Wired-Tiger"

Anonymous  Oct 31, 2020 
Printed Page 437
1st paragraph, third item

"baking up" should be "backing up"

Anonymous  Oct 31, 2020 
Printed Page 441
second set of shell commands

The commands for "archiving and compress the bcakup on a remote system using SSH", seemingly write the file on the wrong system. dd if=/dev/vg0/mdb-snap01 | ssh username@example.com gzip > /opt/backup/mdb-snap01.gz

This will send all the data from the volume group, to the gzip command on the remote host, however the redirection to file > is interpreted by the local file system, so the file will be written on the system calling ssh (local), and not gzip, so the data is copied back to the system.

Two lines later when you try and run gzip again the file will not be there.

I think, but didn't test, that the command should be:

dd if=/dev/vg0/mdb-sap01 | ssh username@examplec.com /bin/bash -c "gzip > opt/backup/mdb-snap01.gz"


Steve Ramage  Oct 04, 2020 
Printed Page 468
1st paragraph, 8th line

You can run mongod.exe --help to see all the possible options.
--> You can run bin/mongod --help to see all the possible options.

"mongod.exe" should be "bin/mongod" if running on Linux/MacOS X.

Minyi Choi  Mar 30, 2021 
Printed Page 479
Left column, last row

the index entry is for "deMormalization" instead of "deNormalization"

Anonymous  Nov 08, 2020