-
Type:
Bug
-
Resolution: Done
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: JavaScript
-
None
-
Environment:Win 7 64 bit, Mongo 2.0
-
Windows
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
I suppose this pretty much should speak for its self. At first I thought just the internal function name doubled up, but the custom name would remain when __toString() is called in php. But what it does is take the full internal function name, then re-assign a prefix to it, returning the entire pre-update name as the new function name. Attached is a screenshot, before and after the update I've pasted below.
> a = db.validation.findOne(
{name:'cellPhone'})
{
"_id" : ObjectId("4eadb65ba653908619848869"),
"name" : "cellPhone",
"error" : "At least one phone number must be entered",
"code" : function cf_31_f_cf_28f() {},
"errorGroup" : "cellPhone"
}
> a.errorGroup = 'phone'
phone
> db.validation.save(a)
> a = db.validation.findOne(
)
{
"_id" : ObjectId("4eadb65ba653908619848869"),
"name" : "cellPhone",
"error" : "At least one phone number must be entered",
"code" : function cf_32_f_cf_31_f_cf_28f() {
},
"errorGroup" : "phone"
}
> a.code = function code(a){}
function code(a) {
}
> db.validation.save(a)
> a = db.validation.findOne(
)
{
"_id" : ObjectId("4eadb65ba653908619848869"),
"name" : "cellPhone",
"error" : "At least one phone number must be entered",
"code" : function cf_33_f_code(a) {},
"errorGroup" : "phone"
}
> a.errorGroup = 'phone1'
phone1
> db.validation.save(a)
> a = db.validation.findOne(
)
{
"_id" : ObjectId("4eadb65ba653908619848869"),
"name" : "cellPhone",
"error" : "At least one phone number must be entered",
"code" : function cf_34_f_cf_33_f_code(a) {},
"errorGroup" : "phone1"
}
> b = db.validation.findOne(
)
{
"_id" : ObjectId("4eb0036aa65390861984886a"),
"name" : "businessPhone",
"error" : "At least one phone number must be entered",
"code" : function cf_35_f_cf_30_f_cf_28f() {},
"errorGroup" : "phone"
}
> b.run = function(a){}
function (a) {
}
> db.validation.save(b)
> b = db.validation.findOne(
)
{
"_id" : ObjectId("4eb0036aa65390861984886a"),
"name" : "businessPhone",
"error" : "At least one phone number must be entered",
"code" : function cf_36_f_cf_35_f_cf_30_f_cf_28f() {},
"errorGroup" : "phone",
"run" : function cf_37f(a) {
}
}
> delete b.run
true
> db.validation.save(b)
> b = db.validation.findOne(
)
{
"_id" : ObjectId("4eb0036aa65390861984886a"),
"name" : "businessPhone",
"error" : "At least one phone number must be entered",
"code" : function cf_38_f_cf_36_f_cf_35_f_cf_30_f_cf_28f() {},
"errorGroup" : "phone"
}