After the cataract surgery, the doctor will give you an eye shield for sleeping. And you need to wear your protective eye shield or covering while you sleep, and do not sleep on the side of your operated eye until your doctor tells you it is safe.
After the cataract surgery, you'd better keep a good diet, not eating the spicy food which may stimulate your eye nerves. About the right sleeping posture, you just not sleep by lying on your stomach which may add pressure on your eyes. And you'd better sleep early which will provide a good rest for the eyes.