[SERVER-12079] Update using '$id', '$db', and '$ref' are acceptable field names in subdocs fails Created: 12/Dec/13  Updated: 07/Mar/14  Resolved: 12/Dec/13

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.4.6, 2.5.4
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jonathan Abrahams Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Standalone, OSX


Issue Links:
Related
Operating System: ALL
Participants:

 Description   

Test failure in QA-322/dollarsigns.js

// Test that '$id', '$db', and '$ref' are acceptable field names in
// the correct case (ie, subdoc) but not otherwise.
// SERVER-3231
coll.update(

{ n: 0 }

, { $set: { $id: 1, $db: 1, $ref: 1 }});
var gle = db.runCommand(

{ getLastError: 1 }

);
assert(gle.err != null, 'gleObj: ' + tojson(gle));
coll.update(

{ n: 0 }

,

{ n: 0 }

);

coll.update(

{ n: 0 }

, { $set: { 'x.$id': 1, 'x.$db': 1, 'x.$ref': 1 }});
var gle = db.runCommand(

{ getLastError: 1 }

);
assert(gle.err == null, 'gleObj: ' + tojson(gle));
coll.update(

{ n: 0 }

,

{ n: 0 }

);

Assert thrown from second update:

2013-12-12T12:39:01.485-0500 assert failed : gleObj:

{ "err" : "The DBRef $db field must be a String, not a NumberDouble", "code" : 55, "n" : 0, "connectionId" : 171, "ok" : 1 }

at src/mongo/shell/assert.js:7



 Comments   
Comment by Scott Hernandez (Inactive) [ 12/Dec/13 ]

This test is incorrect. The correct tests are checked into the server.

Please read the DBRef docs to better understand why the test is incorect: http://docs.mongodb.org/manual/reference/database-references/#dbref

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