Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-218

Using $set in collection.update() doesn't maintain order

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.4
    • Component/s: None
    • Labels:
    • Environment:
      1.4.7, Ubuntu Linux 10.04, NodeJS 0.10.29, MongoDB 2.4.10

      We are using loc2d indexes on a 'loc' property of our documents. When adding these documents to a collection, we run:

      collection.update({
          'set': {
              'loc.long': -100,
              'loc.lat': 45
          }
      },
      { 'upsert': true }
      );
      

      Which results in:

      {
          '_id': [Id],
          'loc': {
              'lat': 45,
              'long': -100
          }
      }
      

      Which on the environment described seems to work incorrectly and set the lat before the long. Since loc2d indexes are order specific, that is posing a problem for us. In testing on a dev box with Mongo 2.6 the problem seems to be fixed. Behavior seems inconsistent either way. Did I miss the fix in a change log, or am I doing something wrong?

      Thanks.

            Assignee:
            christkv Christian Amor Kvalheim
            Reporter:
            four43 Seth Miller
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: