db.mytable.truncate() cleans all the data out of the table, but does
not reset the counter for the id field.  (See Ch 4 of the book.)

db.products.truncate('RESTART IDENTITY CASCADE') resets the counter
back to zero, so the first record gets an id of 1.

Resetting the counter is useful for automated testing.

Reply via email to