[SERVER-11365] using the old addUser syntax gives a warning followed by a success with confusing ux Created: 24/Oct/13  Updated: 11/Jul/16  Resolved: 06/Nov/13

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

Type: Bug Priority: Major - P3
Reporter: Matt Dannenberg Assignee: Spencer Brody (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

here was what I did/saw
the first result message was confusing to me
the latter half it is actually the successful user addition, I thought it was showing me the spec of a user object
either better reporting or an error (and no op) in place of a warning should occur

> db.addUser("foo", "bar")
WARNING: This form of the addUser shell helper (that takes username, password, and readOnly boolean) is DEPRECATED. Use the form that takes a user object instead

{ "user" : "foo", "roles" : [ "dbOwner" ] }

> db.addUser(

{user:"foo", roles:["dbOwner"]}

)
2013-10-24T15:22:54.154-0400 Error: couldn't add user: Must provide a 'pwd' field for all user documents, except those with '$external' as the user's source db at src/mongo/shell/db.js:1005

> db.addUser(

{user:"hi", pwd:"asdf", roles:["dbOwner"]}

)

{ "user" : "hi", "roles" : [ "dbOwner" ] }

 Comments   
Comment by auto [ 06/Nov/13 ]

Author:

{u'username': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@10gen.com'}

Message: SERVER-11555 SERVER-11365 Deprecate addUser shell helper in favor of new createUser helper
Branch: master
https://github.com/mongodb/mongo/commit/662dcd9962a3665ccafb9c862e025c53054f4235

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