Field names of items in nested arrays are not validated

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • 3.0.0
    • Affects Version/s: None
    • Component/s: API
    • None
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      Successor of JAVA-794.

      If array contains map/DBObject with dots in field names - they wouldn't be detected.

          @Test(expectedExceptions = IllegalArgumentException.class)
          public void testDotKeysArrayFail() {
              DBCollection collection = _db.getCollection("testdotkeysFail");
      
              DBObject obj = new BasicDBObject("x", 1)
                      .append("y", 2)
                      .append("array", new Object[]{new BasicDBObject("foo.bar", "baz")});
              collection.insert(obj);
          }
      
          @Test(expectedExceptions = IllegalArgumentException.class)
          public void testDotKeysArrayFail3() {
              DBCollection collection = _db.getCollection("testdotkeysFail");
      
              final Map<String, Object> map = new HashMap<String, Object>(1);
              map.put("foo.bar",2);
              DBObject obj = new BasicDBObject("x", 1)
                      .append("y", 2)
                      .append("array", new Object[]{map});
              collection.insert(obj);
          }
      

            Assignee:
            Unassigned
            Reporter:
            Uladzimir Mihura (Inactive)
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: