ruby-on-rails - How to implement common search in mongo id when using dynamic attributes in Rails
问题描述
I have a collection called Example, all the fields of a collection are dynamic. I want to perform a common search. I have no idea how I can do. For example, if I search for "hello" it should return all the objects of a collection which contains name irrespective of the fields the value contained.
Example:
{ id: 111234, desc: 'hello world' },
{ id: 545ttt, title: 'hello title' },
{ id: sfsd3, data: 'hello' }
My query should return all the above records if I search for hello. I found a mongoid_search gem but I did not find anything related to dynamic fields search.
Thanks in Advance.
解决方案
推荐阅读
- html - 将按钮高度设置为父元素的 100%,而不设置父元素高度
- angular - 通过 fileReplacements 在 Angular 中处理静态页面
- python - xhtml2pdf为本地html文件生成空白pdf
- javascript - 如何根据对象值将对象数组转换为对象数组?
- ruby - 如何在 Ruby 中的所有方法之间共享 lambda 函数?
- c - 如何将文件中的单词存储在单独的变量中?
- html - 如何仅将 CSS 应用于父级,不包括子级?
- tensorflow - TensorFlow 与对象检测 API 联合
- ttk - ttk.Optionmenu 文档
- flutter - 如何从 Razor Pay 获取交易详情?