首頁  >  文章  >  資料庫  >  如何把 正则表达式 存储到 mongodb 里面(mongoid)

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

WBOY
WBOY原創
2016-06-07 16:31:071374瀏覽

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

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn