top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Encrypting only the value in key-value pair in mongodb

0 votes
404 views

I want to implement the encryption and that to only to value in key-value pair in mongodb .Can anyone please provide a workable solution?

posted Oct 7, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Hi try this solution on mongo console alternative way to do the same is that you can use md5 or sha-1 at front end/back end depending on your requirement.

db.collection.find().forEach( function(info){
  info.hashValue = hex_md5(info.value);
  db.collection.save(info);
}); 
answer Oct 8, 2016 by Shivam Kumar Pandey
Similar Questions
+1 vote

Query description: I have a collection name student_db and added a document in a collection with entries (name: "alok, age : 31 and profession: "xyz"). After inserting the document into student_db database, I want to add another (key:value ) pair i.e. salary: 50000.

Can someone help me out to resolve this problem ?

...