我们如何在MongoDB数据库中的加密数据上实现搜索功能?
我已经使用了 Mongoose-Field-Field-compryption 软件包,该软件包使我可以在存储和访问它之前对数据进行加密和解密。但是我需要直接在查询本身中为加密字段实现搜索功能。
这些字段是电子邮件ID,名称,手机号码,地址等。
I have used the mongoose-field-encryption package which allows me to encrypt and decrypt the data before storing and accessing it. But I need to implement search functionality for the encrypted fields directly in the query itself.
The fields are email id, name, mobile number, address, etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用汇总查询的
$ function
功能在查询中解密数据并应用过滤器。探索$ function
在这里 。像它所做的那样,创建一个名为
decryptedemail
的新字段,并且它的值是通过解密函数计算的,然后我们正在筛选出我们想要的电子邮件You can use aggregate query's
$function
feature to decrypt data within the query and apply filters. Explore$function
here. Something likewhat it does is, create a new field named
decryptedEmail
and the value of it is being computed by a decrypt function, and then we are filtering out the email we want