[SERVER-30903] "use local" shell helper failed with "db.getSession(...).getSiblingDB is not a function" Created: 30/Aug/17  Updated: 30/Oct/23  Resolved: 01/Sep/17

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

Type: Bug Priority: Major - P3
Reporter: Siyuan Zhou Assignee: Max Hirschhorn
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-30686 Integrate retryWrites into mongo shel... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: TIG 2017-09-11
Participants:

 Description   

use local returns the following error.

close_cursor_on_adding_new_shards-configRS:PRIMARY> use local
2017-08-30T16:56:12.109-0400 E QUERY    [thread1] TypeError: db.getSession(...).getSiblingDB is not a function :
shellHelper.use@src/mongo/shell/utils.js:681:10
shellHelper@src/mongo/shell/utils.js:668:15
@(shellhelp2):1:1

Autocomplete also failed.



 Comments   
Comment by Githook User [ 01/Sep/17 ]

Author:

{'username': 'visemet', 'name': 'Max Hirschhorn', 'email': 'max.hirschhorn@mongodb.com'}

Message: SERVER-30903 Add test for shellHelper.use().
Branch: master
https://github.com/mongodb/mongo/commit/f1530d925c530004d107c56a8dd012d26304038c

Comment by Max Hirschhorn [ 30/Aug/17 ]

Leaving the ticket open to add a test case for this tomorrow. It should be possible to (1) define a global db object in a test in the jstests/noPassthrough/ directory, (b) call shellHelper.use() with another database name, and (c) verify that db.getName() return the new name. Additionally, it would be good to verify the the behavior when Mongo.prototype.startSession() is called and that the DriverSession is shared by both DB instances (i.e. before and after calling {{shellHelper.use()).

Comment by Githook User [ 30/Aug/17 ]

Author:

{'username': 'visemet', 'email': 'max.hirschhorn@mongodb.com', 'name': 'Max Hirschhorn'}

Message: SERVER-30903 Fix shellHelper.use() and setting global `db` object.
Branch: master
https://github.com/mongodb/mongo/commit/cef9cd4d98e15dd3ed2b94939e45578335c7876f

Generated at Thu Feb 08 04:25:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.