-
Notifications
You must be signed in to change notification settings - Fork 2
/
database.js
48 lines (38 loc) · 1.15 KB
/
database.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var mongoose = require( 'mongoose' );
var mongooseLong = require('mongoose-long')(mongoose);
var Schema = mongoose.Schema;
var SchemaTypes = mongoose.Schema.Types;
// KEP Schema
var keps = new mongoose.Schema({
aa : Number,
kepCode : Number,
kepTitle : String,
area : String,
county : String,
region : String,
address : String,
tk : Number,
phoneNumber : SchemaTypes.Long,
fax : Number,
email : String,
comments : String,
lat : Number,
lon : Number
});
var kepDocs = mongoose.model('keps', keps);
//Connect to local database
mongoose.connect('localhost', 'findnearestkeps');
/*
Command to import database from CSV
mongoimport --db dbName --collection collectionName --type csv --headerline --file filePath
@dbName --> findnearestkeps
@collectionName --> keps
@filePath (Depents on user preferences)
*/
/*
Command to export database to CSV
mongoexport --db dbName --collection collectionName --csv --fields aa,kepCode,kepTitle,area,county,region,address,tk,phoneNumber,fax,email,comments,lat,lon --out filePath
@dbName --> findnearestkeps
@collectionName --> keps
@filePath (Depents on user preferences)
*/