[SERVER-37062] db.watch does not show up in autocomplete or help Created: 09/Sep/18 Updated: 29/Oct/23 Resolved: 15/Dec/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 4.1.2 |
| Fix Version/s: | 4.2.0 |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Kevin Albertson | Assignee: | Backlog - Query Optimization |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Query Optimization
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Operating System: | ALL | ||||||||||||||||
| Backport Requested: |
v4.0
|
||||||||||||||||
| Sprint: | Query 2019-06-03 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Linked BF Score: | 0 | ||||||||||||||||
| Description |
|
In the shell, the autocomplete list for a db object does not include the watch helper. It looks like the autocomplete function finds properties on an object using Object.keySet, defined here which iterates over enumerable properties. Object.getOwnPropertyDescriptor shows that the watch property is not enumerable:
But I'm not sure why watch is not enumerable while other similarly defined properties like getFreeMonitoringStatus are. Additionally, db.watch does not show up in the output of db.help(). |
| Comments |
| Comment by Githook User [ 10/Dec/19 ] |
|
Author: {'email': 'charlie.swanson@mongodb.com', 'name': 'Charlie Swanson', 'username': 'cswanson310'}Message: Revert " This reverts commit b7a300db322cad07c305f287d1f06540c783a313. |
| Comment by Githook User [ 09/Dec/19 ] |
|
Author: {'name': 'Charlie Swanson', 'username': 'cswanson310', 'email': 'charlie.swanson@mongodb.com'}Message: (cherry picked from commit b85b159f44e155ea05b456552a1cd5782a7d7850) |
| Comment by Githook User [ 30/May/19 ] |
|
Author: {'name': 'Davis Haupt', 'email': 'davis.haupt@mongodb.com', 'username': 'davish'}Message: |
| Comment by Davis Haupt (Inactive) [ 29/May/19 ] |
|
Seems like the issue with watch not showing up in autocomplete (i.e. not being returned in the call to keySet) was related to the fact that watch() used to be a deprecated method on prototype as well (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/watch). Properties inherited from Object aren't enumerable unless explicitly made so, so watch() was left out of autocomplete. On the newest version of the JS engine being used by the shell that was updated in this commit, Object.prototype.watch() has been removed, and so the watch is enumerable. |