Query in tranformed collection fields


#1

In collection transform i decrypt the encrypted field lastname

doc.lastname = CryptoJS.AES.decrypt(doc.lastname,secretKey).toString(CryptoJS.enc.Utf8);

This works and the html table shows the decrypted fieldname.

How would i find / query for (partitial) matches? Transform takes place after find. So People.find({lastname: ‘something’}) doesn´t work.

Info:The decryption needs to take place client side


#2

Transforms are only applied when the data is being copied from a cursor to an object. So, if the cursor did not have too many rows, you could fetch() the data and perform the search on the resulting array.


#3

thanks for the fast answer. I was hoping there is a better solution.