Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-3231

Upsert with $db is failing

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.2
    • Component/s: Write Ops
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL

      Description

      A similar problem was reported a while back as SERVER-627. The fix covered $id and $ref cases, but didn't fix it for references containing a $db value. If you check https://github.com/mongodb/mongo/blame/master/db/jsobj.cpp @ line 847 and 847 you'll see that it checks for $ref and $id, but not for $db. This is causing certain upserts to fail with "not okForStorage". Removing the $db value from the references before attempting to upsert avoids the problem, so I'm using that as a workaround for now.

      Also, it took me ages to riddle out what was causing this. Is there any way you could give more specific information about the invalid syntax? Something like "okForStorage failed with message: key '$db' is not allowed. Check your record and try again." would have saved an incredible amount of time. "not okForStorage" is just cryptic and unhelpful.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              scotthernandez Scott Hernandez
              Reporter:
              bugslayer John Crenshaw
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: