Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-13688

Picky errors from 2.6 are needlessly backwards incompatible

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.0
    • Component/s: None
    • Labels:
    • ALL
    • Hide

      db.foo.update({$set: {}});
      db.foo.update({}, {$unset: {}});

      { $search: 'green' }


      { foo: 1 }


      db.foo.update({$set: {}}); db.foo.update({}, {$unset: {}}); db.foo.find({$text: { $search: 'green' } }).hint( { foo: 1 } );

      MongoDB 2.6 will throw an error in the following situations:

      • Someone tries to use hinting with a $text index. I understand you don't support it, but in the past, features that were incompatible with hinting (like "count" until somewhere in 2.5.x) just caused it to be ignored. No need to break working code over it.
      • An empty $set clause is used. Why force developers to add code to specifically not supply an empty $set clause when it's easily ignored by the server and it was valid in 2.4.x?
      • An empty $unset clause is used. See above.

      All three of these are a hassle to avoid when building queries dynamically.

      Perhaps an error log level for "linting" would be a more appropriate place to report this kind of thing.

      • * *

      The move to 2.6 has been worth it for us due to the availability of text searches as part of normal queries, which is a big improvement in the ease of writing query builder code. Thank you for that change.

            Unassigned Unassigned
            boutell Thomas Boutell
            0 Vote for this issue
            8 Start watching this issue