Command line for add first user

I set up a new replica set and rs.status() gives out the expected status. When I try to add the first user from command line using eval

 <code>mongo admin --port 31120 --eval "db.createUser({user: "admin", pwd:"webscale",roles:["root"]})"</code>

The terminal gave me the error message:
ReferenceError: admin is not defined

But after I enter the mongo shell and create user under the admin database, everything works fine. I want to know what is wrong with the first command, or I can not do it in that way. Any hint will be appreciated.

Hi nayamama,

I think your issue is the double quotes on key values inside double quotes of the eval string.

Hope this helps,

David

Yes, it is the cause of the problem. Thanks a lot.