https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-mongodb-on-ubuntu-16-04?fbclid=IwAR0j2APdeVoL-8lQtql7o12_j3CR57d6nDEKVJMehWU9Zyrpg7n_aNQwdDI
mongo
show dbs
mongo -u nicole -p --authenticationDatabase admin
— Configuring
sudo systemctl restart mongod
sudo systemctl status mongod
— Testing the Remote Connection
mongo -u AdminSammy -p --authenticationDatabase admin --host IP_address_of_MongoHost
Start MongoDB
$ sudo service mongod start
【mong|mong , Flask】Stop MongoDB.
$ sudo service mongod stop
Restart MongoDB.
$ sudo service mongod restart
================MongoDB Command ======================
use DATABASE_NAME
show dbs
insert many document
https://docs.mongodb.com/manual/tutorial/insert-documents/
youtube
https://www.youtube.com/watch?v=Phe9B2HRVmc
stackoverflow
https://stackoverflow.com/questions/11609647/import-more-than-1-json-file-using-mongoimport
github
https://gist.github.com/fabien0102/88dcaa184d801fd5e67a
ls -1 *.json | while read jsonfile;
do mongoimport -d support -c logs -file $jsonfile --jsonArray -type json;
done
--Import all files from a folder:
ls *.json | xargs -I filename
mongoimport -d targetDatabase -c targetCollection --file /home/myFiles/myJsonFile.json-u username -p password --authenticationDatabase admin
===================================
get web
wget URL (RAW DATA)
history | word
git clone
rm *.md
=======================================================================
AJAX:-> javascript 得到URL的 JSON content
var ourRequest = new XMLHttpRequest()
ourRequest.open('Get', 'https://learnwebcode.github.io/json-example/animals');
ourRequest.onload = function() {
var ourDate = JSON.parse(ourRequest.responseText);
console.log( ourData[0]);
}
ourRequest.send();
================================================
var pageCounter = 1;
var animalContainer = document.getElementById("animal-info");
AjAx: -> javascript 监听clicker
var btn = document.getElementById("btn");
btn.addEventListener("click" ,function(){
var ourRequest = new XMLHttpRequest()
ourRequest.open('Get', 'https://learnwebcode.github.io/json-example/animals-' + pageCounter + '.json');
ourRequest.onload = function() {
if(ourRequed=st.status >= 200 && ourRequest < 400) { // request 成功
var ourDate =JSON.parse(ourRequest.responseText);
//console.log( ourData[0]);
renderHTML( outData);
}else {
console.log("we connect to the server , but it returned an error");
}}// ourRequest.onload
// handle the error request
ourRequest.onerror = function(){
console.log("connectin error ");
}
ourRequest.send();
pangCounter ++;
if( pageCounter > 3) {
btn.classList.add( "hide-me");
}
} );
function renderHTML( data) {
varhtmlString = " ";
for( i =0;
i < data.length;
i++) {
htmlString +="" + data[i].name + " is a "+ data[i].specise + "likes to eat " + ;
for( ii=0;
ii
how do i find the JSON endpoint URLS ?
fill text JSON
ERROR handling for AJAX request ? -> RESTful
推荐阅读
- flask|Flask Mega-Tutorial V2.0 第13章(I18n和L10n)
- ModuleNotFoundError: No module named 'flask.ext'
- vs|VSCode编写简单flask文件&配置其虚拟运行环境(Windows)
- python|Flask jinja2模板加载静态文件
- 代码|python3 flask开发05 加载图片 添加css样式
- flask|Nginx+uwsgi+flask部署实战
- Flask扩展( Flask-Bootstrap)