    def test_bad_dbref(self):
        c = self.db.test
        c.drop()

        # Incomplete DBRefs.
        self.assertRaises(
            InvalidDocument,
            c.insert, {'ref': {'$ref': 'collection'}})

        self.assertRaises(
            InvalidDocument,
            c.insert, {'ref': {'$id': ObjectId()}})

        ref_only = {'ref': {'$ref': 'collection'}}
        id_only = {'ref': {'$id': ObjectId()}}

        # Force insert of ref without $id.
        c.insert(ref_only, check_keys=False)
        self.assertEqual(DBRef('collection', id=None), c.find_one()['ref'])
        c.drop()

        # DBRef without $ref is decoded as normal subdocument.
        c.insert(id_only, check_keys=False)
        self.assertEqual(id_only, c.find_one())
NVD is only using a subset of CWE for mapping instead of the entire CWE, and the weakness type is not covered by that subset.