dbAccess.services now works
This commit is contained in:
parent
19926dc9aa
commit
5ff40057c3
@ -5,12 +5,23 @@ const dbPort = process.env.OWL_DB_PORT || 27017
|
||||
const dbHost = process.env.OWL_DB_HOST || "localhost"
|
||||
const uri = `mongodb://${dbUser}:${dbPass}@${dbHost}:${dbPort}`;
|
||||
|
||||
import { MongoClient } from 'mongodb';
|
||||
const { MongoClient } = require('mongodb');
|
||||
|
||||
const client = new MongoClient(uri);
|
||||
const db = client.db(dbName);
|
||||
|
||||
async function put(data,collection) {
|
||||
async function putCorpusAll(data){
|
||||
await client.connect();
|
||||
var coll = db.collection("corpusAll");
|
||||
var result = coll.insertMany(data);
|
||||
console.log(result);
|
||||
};
|
||||
|
||||
async function putStations(data){
|
||||
|
||||
};
|
||||
|
||||
async function putData(data,collection) {
|
||||
await client.connect()
|
||||
var coll = db.collection(collection);
|
||||
var result = coll.insertMany(data);
|
||||
@ -25,8 +36,10 @@ async function checkCrs(crs) {
|
||||
|
||||
}
|
||||
|
||||
module.export = {
|
||||
put,
|
||||
module.exports = {
|
||||
putData,
|
||||
putCorpusAll,
|
||||
putStations,
|
||||
getCrs,
|
||||
checkCrs
|
||||
}
|
Reference in New Issue
Block a user