[SERVER-9097] okForStorage should be stricter when checking for DBRefs Created: 22/Mar/13  Updated: 16/Sep/13  Resolved: 16/Sep/13

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

Type: Bug Priority: Minor - P4
Reporter: Thomas Rueckstiess Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-7557 Update doesn't support "$"s in the fi... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

DBRefs are okForStorage in jsobj.cpp:891, but the code only checks for existence of $ref or $id. It should be stricter, checking for both $ref and $id.

Currently, these return true for okForStorage:

  • {$id: 1}
  • {$ref: 1}

But should probably return false as they are not valid documents.

This is used in many places to verify valid fields, including DBRefs.


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