LaTeX: How to set the Table of Contents (TOC) depth

LaTeX question: Is there a way I can control the depth of the table of contents (\tableofcontents) using LaTeX?

I just ran into the following problem: For a technical document I’m creating with LaTeX, there are a lot of sections that have a repeated/consistent format. This is exactly what I want, but for a 160 page document I ended up with a 15-page table of contents (TOC). This made me wonder, is there are way to control the “depth” of the table of contents?

After a little research ... yes, I can. Here’s some sample code that I put in the LaTeX preamble, just before the \tablofcontents tag:

\setcounter{tocdepth}{1}
\tableofcontents

This created a much smaller TOC; only 2 pages. It created only an entry for each Chapter and Section, and did not include any Subsections, or anything else beneath the Section depth. Perfect — this is exactly what I want.