You may want to copy or rename ~/.mongorc.js to ~/.mongoshrc.js.īy default, the mongosh or mongo command connects with the local MongoDB database on the localhost:27017. Warning: Found ~/.mongorc.js, but not ~/.mongoshrc.js. $ mongosh mongodb://192.168.0.5:9999/shipsįor example, the -nodb allows you to run MongoDB shell without connecting to a database.Ĭurrent Mongosh Log ID: 6166bab1a1acde9f7f388c27 Start mongosh using 'ships' database on specified connection string: js and will exit after unless -shell is specified. Mongodb://192.168.0.5:9999/foo Connection string URI can also be usedĪ list of files to run. keyVaultNamespace llection to store encrypted FLE parameters awsSessionToken Optional AWS Session Token ID awsSecretAccessKey AWS Secret Key for FLE Amazon KMS awsAccessKeyId AWS Access Key for FLE Amazon KMS apiDeprecationErrors Fail deprecated commands for the specified API version apiVersion Specifies the API version to connect with tlsDisabledProtocols Comma separated list of TLS protocols to disable pem file that contains the Certificate Revocation List tlsCertificateSelector TLS Certificate in system store (Windows and macOS only) tlsAllowInvalidCertificates Allow connections to servers with invalid certificates tlsAllowInvalidHostnames Allow connections to servers with non-matching hostnames tlsCAFile Certificate Authority file for TLS tlsCertificateKeyFilePassword Password for key in PEM file for TLS tlsCertificateKeyFile PEM certificate/key file for TLS sspiRealmOverride Specify the SSPI server realm (available on Windows) sspiHostnameCanonicalization Specify the SSPI hostname canonicalization (none or forward, available on Windows) gssapiServiceName Service name to use when authenticating using GSSAPI/Kerberos awsIamSessionToken AWS IAM Temporary Session Token ID authenticationMechanism Authentication mechanism authenticationDatabase User source (defaults to dbname) p, -password Password for authentication u, -username Username for authentication retryWrites Automatically retry write operations upon transient network errors norc Will not run the '.mongoshrc.js' file on start up nodb Don't connect to mongod on startup - no 'db address' expected shell Run the shell after executing files quiet Silence output from the shell during the connection process verbose Increase the verbosity of the output of the shell f, -file Load the specified mongosh script The -help command display all the commands which you can use with mongo or mongosh, as shown below. mongosh is the new MongoDB shell with some more features than the old mongo shell. You can start MongoDB Shell by executing mongo or mongosh command on the command prompt/terminal. It acts as a command-line client of the MongoDB server. I also verified multiple times that I don’t have a typo somewhere: The collection I see at Cluster -> Collections in the webinterface is definitely called test.MongoDB Shell is the quickest way to connect, configure, query, and work with your MongoDB database. The version of Compass is 1.21.2 and thereby above 1.12.Īfter adding the string to Compass, it added some things like “…Compass&retryWrites=true&ssl=true” which look to me like simply the default parameters. The end of the connection string also shows /test, so the correct database is addressed. If it’s important: I simply copied the connection string from Cluster -> Connect -> Connect using MongoDB Compass and filled in the credentials. Only when I grant readWrite for the whole database I can see all Collections, even empty ones, in Compass. Still, I can’t see any Collection with the user in Compass, also when setting the privilege to a different non-empty Collection. (Also if I change the privilege to a different Collection for the user and try again through the api, I get an appropriate error from Atlas, so I’m definetely accessing via said user) Accordingly the user does have write access to the collection and the privileges work correctly. There are several documents in testcollection, added at first through the atlas webinterface but later on also successfully with the user in question through the api. Sorry, I should’ve mentioned that in advance:
0 Comments
Leave a Reply. |