We present a tutorial review on the topics related to current development in cavity optomechanics, with special emphasis on cavity optomechanical effects with ultracold gases, Bose-Einstein condensates, and spinor Bose-Einstein condensates. Topics including the quantum model and nonlinearity of the cavity optomechanics, the principles of optomechanical cooling, radiation-pressure-induced nonlinear states, the chaotic dynamics in a condensate-mirror-hybrid optomechanical setup, and the spin-mixing dynamics controlled by optical cavities are covered.