[SERVER-10354] db.getLastError() always returns null when using autocomplete Created: 26/Jul/13 Updated: 02/Jun/17 Resolved: 02/Jun/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Andrew Guo | Assignee: | DO NOT USE - Backlog - Platform Team |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Backwards Compatibility: | Fully Compatible |
| Operating System: | ALL |
| Steps To Reproduce: | db.test.insert({_id:1}) |
| Participants: |
| Description |
|
I use Mongodb 2.4.5 for windows(32bit). The db.getLastError() always returns null even if an error occurs, but only when using auto-complete for the "getLastError" call. |
| Comments |
| Comment by Andrew Morrow (Inactive) [ 02/Jun/17 ] |
|
Most uses of getLastError are now obviated by newer write mechanisms, so it does not make sense to invest effort in repairing this edge case. If this is still an issue in practice, avoid using tab completion. |
| Comment by Eric Daniels (Inactive) [ 02/Aug/13 ] |
|
This error is caused by using autocomplete on a DB object. Since getCollectionNames() is called, it will set the last error to nothing if it succeeds which it does. The problem is storing the last error before calling this and then restoring it as there exists no way to do this currently. An alternative is to temporarily create a new connection for the autocomplete which will have its own getLastError context. |
| Comment by Daniel Pasette (Inactive) [ 02/Aug/13 ] |
|
i'm able to repro this on all versions and osx as well by using the autocomplete described by mirao. |
| Comment by Jaromir Obr [ 27/Jul/13 ] |
|
The issue happens to me if I'm using autocomplete in mongo shell Steps to reproduce: ) ) Type the command db.getLastError(), do not use shell autocomplete: Type the command, use autocomplete: Expected result: Actual result: Used SW: |