Privacy of data owners and query users is vital in modern clouding data management. Many researchers have been done on cloud security, but most of them are focused on the privacy of data owners or of query users separately. How to protect the privacy of the data owners and users simultaneously is a great challenge. In this paper, a solution of data storage and query protocol based on classical homomorphic encryption scheme is given to preserve privacy of both data owners and query users. The authors' main efforts are put on NoSQL database which is less structural than relational database.