We consider the Merton problem of optimal portfolio choice when the traded instruments are the set of zero-coupon bonds. Working within an infinite-factor Markovian Heath-Jarrow-Morton model of the interest rate term structure, we give sufficient conditions for the existence and uniqueness of an optimal trading strategy. When there is uniqueness, we provide a characterization of the optimal porfolio as a sum of mutual funds. Furthermore, we show that a Gauss-Markov random field model proposed by Kennedy [22] can be treated in this framework, and explicitly calculate the optimal portfolio. We show that the optimal portfolio in this case can identified with the discontinuities of a certain function of the market parameters.