Commit 384c0b3c authored by Kapilraj Thangeswaran's avatar Kapilraj Thangeswaran
Browse files

Mise à jour readme et mise à jour script mongo

parent fef97b84
......@@ -14,6 +14,21 @@ This module is able to extract data from a file in Hdoc format and insert them i
## Dependencies
In order to make this project work you have to install Node.js from the following link :
## Instructions
- Install dependencies.
- Then edit the file "config.json" in the "mongo" folder (for more details, please check "Mongo configuration")
- Execute run.bat or
## Mongo configuration
Use "config.json" in the "mongo" folder to specify :
- url : your mongodb's url
- database : the database you are using
- collection : the collection you are using
- request : the request you want to perform (for allowed requests, please check "Supported requests")
## Supported requests
- insert
## User stories
En tant qu’utilisateur rédigeant des documents sous opale, je veux récupérer les exercices corrigés d’un sujet donné dans le but de les réutiliser.
En tant qu’utilisateur rédigeant des documents sous opale, je veux récupérer les cours d’un auteur précis dans le but d’utiliser ses cours comme références.
"url" : "mongodb://localhost:27017/test",
"url" : "mongodb://localhost:27017/",
"database" : "test",
"collection" : "nf29",
"request" : "insert"
\ No newline at end of file
......@@ -3,7 +3,13 @@ const config = JSON.parse(fs.readFileSync('config.json'));
const MongoClient = require('mongodb').MongoClient;
const assert = require('assert');
const ObjectId = require('mongodb').ObjectID;
const url = config['url'];
console.log(config['url'] + "/" + config['database']);
var url = config['url'];
if(url.slice(-1) == "/") {
url += config['database'];
} else {
url += "/" + config['database'];
const resultFile = '../output/result.json';
var insertDocument = function(db, collection, json, callback) {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment