How to copy and paste text in MongoDB shell?
I tried Ctrl+C and Ctrl+V but it didn't work.
Thanks, Michael.
How to copy and paste text in MongoDB shell?
I tried Ctrl+C and Ctrl+V but it didn't work.
Thanks, Michael.
If you are using Windows then Command:
Copy = Ctrl + Insert
Paste = Shift + Insert
This works for Windows as well as Linux:
1. Select your text using Mouse
2. Press Mouse-Right button to Copy & Paste
3. Press Mouse-Right button to Paste copied text from Clipboard
For Windows:
Copy: Right-click anywhere in the command prompt window, then click Mark
. Click the beginning of the text you want to copy. Press and hold down the SHIFT
key, and then click the end of the text you want to copy (or you can click and drag the cursor to select the text). Either right-click the title bar, point to Edit
, and then click Copy
OR press Enter
.
Paste: Position the cursor where you want the text to be inserted: Right-click and then click Paste
.
This is what I did:
I ran mongo shell on the command line to have access to my databases.
I wanted to add some data to a collection.
I wrote the code in a text editor.
Then I tried to use CTRL+C
and CTRL+V
but mongo shell did not accept it.
So instead I RIGHT CLICKED on the command line TAB, CLICKED on EDIT, then CLICKED on PASTE.
I hope this helps.
Please see image gif here
If you want to copy external text to mongo shell , try Right-Mouse click to paste the text. The Right click directly copies the text.
write your shell command in any other text editor. (notepad , sublime , vscode etc).
select your command and then right click and select copy .
now go to your mongodb shell and just right click your command should be pasted.
---------------------------------- Happy Coding ------------------------------------
Most of them check the properties but those properties have to be set to default otherwise it won't work, to make the properties default, in order to make the QuickEdit work by default or all the time follow the below steps.
Right-click on the tab click Defaults, in the Defaults screen->Options Tab and check QuickEdit Mode, Check this image for clarity.
Make sure to check QuickEdit Mode in Options tab
]
Note: click Defaults not Properties
Right-click on the tab click Defaults, in the Defaults screen->Options Tab and go to EDIT OPTIONS and then check the (Use Ctrl+Shift+C/V), Check this image for referenceenter image description here.
Using mongo version 4.0 on windows.
Try removing the tabs from the text you want to paste and then right click in the shell and the text should be pasted.
Copying from the shell works fine by selecting and pressing Ctrl + C
It seems that windows CMD deactivates Quick edition option if an error is risen. Error can occur if mongo command is large enough to overflow CMD buffer. If insertMany command is used buffer size and buffer # have to be increased.
So verify if this properties-options-quick Edit is checked event if it has been done yet.
best regards
For Windows Mongo shell pasting and Marking: normal copy from source then paste in shell by right clicking in shell title (white border) bar at top then selecting EDIT in drop down then select paste. You can also copy "MARK" with this process.
From the mongo shell or the windows command prompt, right-click on the prompt header, navigate to properties, check the option 'Use Ctrl + Shift + C/V as Copy/Paste' - follow through to copy, paste.