Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1418

Java Driver can not update embedded array document

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.12.3
    • Component/s: API
    • Labels:
      None

      this command:
      db.collection.update(

      { <query selector> }

      , { <update operator>:

      { "array.$.field" : value }

      } )
      use array.$.field" as BasicDBObject key, the exception say:

      Exception in thread "main" java.lang.IllegalArgumentException: Document field names can't have a . in them. (Bad Key: 'dimensionArray.$.v')
      at com.mongodb.DBCollection.validateKey(DBCollection.java:1843)
      at com.mongodb.DBCollection._checkKeys(DBCollection.java:1803)
      at com.mongodb.DBCollection._checkObject(DBCollection.java:1790)
      at com.mongodb.DBCollectionImpl.update(DBCollectionImpl.java:256)
      at com.mongodb.DBCollection.update(DBCollection.java:191)
      at com.mongodb.DBCollection.update(DBCollection.java:224)

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            bingyunxl Tao Lin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: