[SERVER-54712] createIndexes permits weights for non-text indexes Created: 22/Feb/21  Updated: 29/Oct/23  Resolved: 30/Mar/21

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

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Arun Banala
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Documented
is documented by DOCS-14323 Investigate changes in SERVER-54712: ... Closed
Related
related to SERVER-54706 listIndexes fails if an index has the... Closed
related to SERVER-53765 Validate index entries at catalog layer Backlog
is related to SERVER-55863 createIndexes permits some text index... Closed
Backwards Compatibility: Minor Change
Operating System: ALL
Sprint: Query Execution 2021-03-08, Query Execution 2021-04-05
Participants:

 Description   

The following are all permitted in 4.4.4, although weights are only meaningful for text indexes:

coll.createIndex({a: 1, c: 1}, {weights: {d: 1}})
coll.createIndex({a: 1, c: 1}, {weights: "$**"})
coll.createIndex({a: 1, c: 1}, {weights: {}})
coll.createIndex({a: 1, c: 1}, {weights: "$foo"}) 

Consider banning them before we release API Version 1.



 Comments   
Comment by Githook User [ 30/Mar/21 ]

Author:

{'name': 'Arun Banala', 'email': 'arun.banala@mongodb.com', 'username': 'banarun'}

Message: SERVER-54712 createIndexes should not permit 'weights' for non-text indexes
Branch: master
https://github.com/mongodb/mongo/commit/4ef2c85a15796f91e938bd8b82912f0571be7790

Comment by Arun Banala [ 25/Mar/21 ]

Code review URL: https://mongodbcr.appspot.com/776040096/

Comment by A. Jesse Jiryu Davis [ 22/Feb/21 ]

Discovered during SERVER-54706. I plan to add a test to fts_indexes.js that these createIndexes invocations are allowed and they don't break listIndexes. As part of this ticket, we should probably remove those tests.

Generated at Thu Feb 08 05:34:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.