欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

如何把 正则表达式 存储到 mongodb 里面(mongoid)

程序员文章站 2022-04-21 22:44:24
...

Mongoid 的 里面有 Regexp 的 类型 我定义如下 field :name_reg, :type = Regexp 运行却报错,请教一下 ,如何把 正则表达式存储到 mongodb 里面 ××××××××××××××× Routing Error undefined method `instantiate' for Regexp:Class Try runnin

Mongoid 的 里面有 Regexp 的 类型

我定义如下

field :name_reg, :type => Regexp

运行却报错,请教一下 ,如何把 正则表达式存储到 mongodb 里面
×××××××××××××××
Routing Error

undefined method `instantiate' for Regexp:Class
Try running rake routes for more information on available routes.
×××××××××××××××××

Below is a list of valid types for fields.

Array
BigDecimal
Boolean
Date
DateTime
Float
Hash
Integer
Moped::BSON::ObjectId
Moped::BSON::Binary
Range
Regexp
String
Symbol
Time
TimeWithZone