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

Array List order not maintained sometimes

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.4.0
    • Component/s: Test Failure
    • Labels:
      None

      Regarding handling lists in Mongo using the Java driver (3.2.2) and mongo db version 3.4
       
      We have been creating a list of strings as follows and storing them in Mongo:

      Document result = new Document();
      result.put("_id", i);
       
      List<String> list = new ArrayList<>();
      list.add("john");
      list.add("jack");
      result.put("listName", list);
      testCollection.insertOne(result);

       
      But, my colleague was testing some code and noticed that the order in one of the items in the list after retrieval from mongo was different than the order that was inserted, but we haven't been able to replicate the issue again.
       
      Is the way we are handling this the right way to do it or do you suggest that we also insert the list order along with the objects?
       

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            asthagupta92@gmail.com Astha Gupta
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: