We have investigated the problem of designing the forward operator and its exact adjoint for two-way wave-equation least-squares migration. We study the problem in the time domain and pay particular attention to the individual operators that are required by the algorithm. We derive our algorithm using the language of linear algebra and establish a simple path to design forward and adjoint operators that pass the dot-product test. We also found that the exact adjoint operator is not equal to the classic reverse time migration algorithm. For instance, one must pay particular attention to boundary conditions to compute the exact adjoint that accurately passes the dot-product test. Forward and adjoint operators are adopted to solve the so-called least-squares reverse time migration problem via the method of conjugate gradients. We also examine a preconditioning strategy to invert extended images.