[SERVER-9276] Console can't handle $symbol fields Created: 08/Apr/13  Updated: 03/Apr/23  Resolved: 19/Apr/13

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Alberto Ornaghi Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mongodb 2.4.0, using console thru mongos (sharded env)


Issue Links:
Duplicate
duplicates SERVER-8799 Sort or Find on Symbol data type thro... Closed
Operating System: OS X
Steps To Reproduce:

put the document into a collection and perform find() on it.

Participants:

 Description   

if I try to query a document that has a $symbol field i receive this:

Mon Apr  8 10:38:25.181 Assertion: 16661:can't handle type: 14 type: "sms"
0x10016fc9b 0x100134129 0x10013460c 0x100114297 0x100118f93 0x1003dafa2 0x1003daa12 0x10043dd59 0x169548c06362 0x169548c1701e 
 0   mongo                               0x000000010016fc9b _ZN5mongo15printStackTraceERSo + 43
 1   mongo                               0x0000000100134129 _ZN5mongo11msgassertedEiPKc + 217
 2   mongo                               0x000000010013460c _ZN5mongo11msgassertedEiRKSs + 12
 3   mongo                               0x0000000100114297 _ZN5mongo7V8Scope16mongoToV8ElementERKNS_11BSONElementEb + 967
 4   mongo                               0x0000000100118f93 _ZN5mongoL8namedGetEN2v85LocalINS0_6StringEEERKNS0_12AccessorInfoE + 1443
 5   mongo                               0x00000001003dafa2 _ZN2v88internal8JSObject35GetPropertyAttributeWithInterceptorEPS1_PNS0_6StringEb + 946
 6   mongo                               0x00000001003daa12 _ZN2v88internal10JSReceiver32GetPropertyAttributeWithReceiverEPS1_PNS0_6StringE + 226
 7   mongo                               0x000000010043dd59 _ZN2v88internal19Runtime_HasPropertyENS0_9ArgumentsEPNS0_7IsolateE + 185
 8   ???                                 0x0000169548c06362 0x0 + 24830426506082
 9   ???                                 0x0000169548c1701e 0x0 + 24830426574878
Error: 16661 can't handle type: 14 type: "sms"

the document is like this (taken from mongohub which seems able to extract it):

{
  "_id": { "$oid" : "51627DBE2AFB65BD1700000A" },
  "type": "addressbook",
  "data": {
    "name": "Bruno Doe",
    "contact": "",
    "info": "bruno.doe",
    "program": { "$symbol" : "skype" },
    "type": { "$symbol" : "peer" }
  }
}



 Comments   
Comment by Alberto Ornaghi [ 22/Apr/13 ]

yes, 2.4.2 solved the issue.
thank you.

Comment by Ben Becker [ 19/Apr/13 ]

Hi Alberto,

This issue should be resolved in v2.4.2 by SERVER-8799. Could you try again after upgrading the shell to v2.4.2?

Comment by Alberto Ornaghi [ 08/Apr/13 ]

data was inserted via mongoid/moped driver (3.1.2/1.4.4). that representation of the document is from MongoHub (a gui for macos to access mongodb documents).

Comment by Tad Marshall [ 08/Apr/13 ]

The current code disallows insertion of field names that begin with '$':

> var doc = {
...   "_id": { "$oid" : "51627DBE2AFB65BD1700000A" },
...   "type": "addressbook",
...   "data": {
...     "name": "Bruno Doe",
...     "contact": "",
...     "info": "bruno.doe",
...     "program": { "$symbol" : "skype" },
...     "type": { "$symbol" : "peer" }
...   }
... }
> 
> doc
{
        "_id" : {
                "$oid" : "51627DBE2AFB65BD1700000A"
        },
        "type" : "addressbook",
        "data" : {
                "name" : "Bruno Doe",
                "contact" : "",
                "info" : "bruno.doe",
                "program" : {
                        "$symbol" : "skype"
                },
                "type" : {
                        "$symbol" : "peer"
                }
        }
}
> db.s9276.insert(doc)
Mon Apr  8 08:18:14.526 JavaScript execution failed: field names cannot start with $ [$oid] at src/mongo/shell/collection.js:L149
> 

How was this data inserted (driver or shell, version)?

Comment by Alberto Ornaghi [ 08/Apr/13 ]

ooops, i reported the wrong document. (by the way the issue is the same even on that one).
just replace 'sms' with 'peer' in the stack trace.

Generated at Thu Feb 08 03:19:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.