[SERVER-13688] Picky errors from 2.6 are needlessly backwards incompatible Created: 22/Apr/14  Updated: 10/Dec/14  Resolved: 19/May/14

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: 2.6.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Thomas Boutell Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: compatibility
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-13883 findAndModify() cannot take an empty ... Closed
is related to SERVER-12266 Update no longer allows empty modifie... Closed
is related to SERVER-13884 $set: {} is now rejected by the updat... Closed
Operating System: ALL
Steps To Reproduce:

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

{ $search: 'green' }

}).hint(

{ foo: 1 }

);

Participants:

 Description   

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.



 Comments   
Comment by Thomas Boutell [ 19/May/14 ]

I appreciate that there is something you want the developer to know here, and suggest using a warning rather than a fatal error to convey it.

Comment by Thomas Boutell [ 19/May/14 ]

Why is it necessary to force everyone who writes code that calls hint() to do a special scan to be sure their query builder didn't touch the $text "third rail"? Why not just ignore hint() in this situation, like you used to in situations where you did not support it?

Comment by Daniel Pasette (Inactive) [ 19/May/14 ]
  1. Hinting with $text: there's no backwards-compatibility issues with $text queries, since $text didn't exist at all in 2.4. Hinting with $text isn't allowed because the text search subsystem currently can only operate on text indexes, so there'd be no way to generate the correct result set from a collection scan or another index.
  2. Empty $set/$unset clause: see SERVER-12266.
Comment by Jeremy Mikola [ 22/Apr/14 ]

Cross-referencing with SERVER-12266, which discusses empty modifiers no longer being permitted.

Generated at Thu Feb 08 03:32:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.