Dear manisha, You are right. It means that oxygen gains two electrons.
thanks expert for very well explained answer. it is very helpful to me. but i have one doubt i.e as when we said that oxygen has -2 oxidation state , here -2 oxidation state means it gain 2 e- . right or not.