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

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

WBOY
WBOYOriginal
2016-06-07 16:31:071401browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn