Question

Is it possible to index a field and then blank it out?

The reason for this would be that I have a plain text field and a field containing the encrypted version of the text. I'd like to index the plain text, and then remove it so only the encrypted data remains.

I tried modifying the passed doc in my index function, but it doesn't seem to affect storage.

Was it helpful?

Solution

No, it is not possible to index a field and then blank it out. It is not possible by design. The views and indexes only reflect the latest version of the documents, therefore when you 'blank' a field, the corresponding view/index will also be blanked. The view/index is kept in sync and there is no option to make them diverge.

To achieve the effect you want, your map or index function would need to decrypt the encrypted field and send it to the index. However the index is not encrypted so that would probably defeat the purpose of having the encrypted field in your document in the first place.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top