I want to encrypt database because confidential data is being stored. I use mongodb with mongoid. It possible for this kind of database? And what alternatives can you recome
Try the mongoid-encrypted-fields gem - it is seamless as it handles encryption using mongoize/demongoize methods.
Just define your field like:
field :ssn, type: Mongoid::EncryptedString
Then you can access it like normal, but the data is stored encrypted.