Second quantisation of the scalar field leads to an algebra of quantum field operators $$ [\phi(x),\phi(y)] = 0, \ \ [\pi(x), \pi(y)] = 0, \ \ [\phi(x),\pi(y)] = i\hbar \delta(x-y). $$ Where the field operators are given by $$ \phi(x) = \int \frac{\text{d}^3 k}{(2\pi)^3 2 \omega_{\mathbf{k}}}\left( a_k e^{i k x} +a^{\dagger}_k e^{-ikx}\right) , \qquad\pi(x)=\partial_0 \phi(x) $$ These are made of two counter rotating terms. However in many body theory I have also seen field operators defined as $$ \phi(\mathbf{x}) = \frac1{\sqrt{V}} \sum_\mathbf{k} a_\mathbf{k} e^{i \mathbf{k}. \mathbf{x}} $$ I can understand why outside of the context of relativistic physics we drop the requirement for covariance, but the counter rotating term has also been dropped and so this definition has a different algebra altogether. The former definition seems like a generalisation of the $\hat{x}$-operator of a 1D harmonic oscillator, whereas the latter seems like a generalisation of the creation operator $\hat{a}$.
This would be fine, and I could accept it as a choice of convention were it not for the fact that I have seen Greens functions defined using both. The greens functions as I understand them allow for the calculation of time ordered operator products by giving a general form for the amplitude of measuring different field values at different times. However this does not seem to enlighten me to why this understanding of the Greens function is conflated with the latter definition.
I have clearly missed something important, but going through the relevant textbooks has failed to uncover what that is. If anyone can give an explanation of what a Green's function is and also explain how these two definitions can be reconciled I would be greatly appreciative.