mirror of
https://github.com/factbook/factbook.json.git
synced 2026-06-22 19:28:07 +02:00
Update MONGO.md
This commit is contained in:
parent
350ad62a87
commit
7ec5b97f9a
1 changed files with 6 additions and 6 deletions
12
MONGO.md
12
MONGO.md
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
# Mongo
|
# Mongo
|
||||||
|
|
||||||
Import [#import]
|
[Import](#import) •
|
||||||
Query Examples[#query-examples]
|
[Query Examples](#query-examples)
|
||||||
|
|
||||||
|
|
||||||
## Import
|
## Import
|
||||||
|
|
@ -19,18 +19,18 @@ To import all documents use a shell script. Example `import.sh`:
|
||||||
``` bash
|
``` bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
MONGOIMPORT=mongoimport
|
MONGOIMPORT = mongoimport
|
||||||
SOURCE =. # assume working folder (as root)
|
SOURCE = . # assume working folder (as root)
|
||||||
|
|
||||||
function import {
|
function import {
|
||||||
echo " importing >${1}<..."
|
echo " importing >${1}<..."
|
||||||
${MONGOIMPORT} --db world --collection factbook --file ${1}
|
${MONGOIMPORT} --db world --collection factbook --file ${1}
|
||||||
}
|
}
|
||||||
|
|
||||||
function import_region {
|
function import_region {
|
||||||
for file in ${SOURCE}/$1/*.json
|
for file in ${SOURCE}/$1/*.json
|
||||||
do
|
do
|
||||||
import ${file}
|
import ${file}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue