-
Notifications
You must be signed in to change notification settings - Fork 3
Database
The database is used to store various program and user data, like indices types, results and custom scripts.
A design dilemma that arose, in the beginning, was if the database was going to be SQL or NoSQL.
Taking into consideration the strong points of each type, the second option was selected, since the data would be mainly semi-structured (as seen in corpus collection, in which some books may lack some indices or whole indices categories) and in order to make use of the scalability and flexibility it provides.
The exact database that is being used is MongoDB.
The database uses three different schemas, corpus.js
, indices.js
and script.js
. Of course, these schemas are not binding, but they outline the structure of each collection and the field types and properties.
Below, the script Schema is shown:
const scriptSchema = new Schema({
name: {
type: String,
unique: true
},
env: String,
path: String,
args: Array
});
With the help of the mongoose
package, the backend can execute a variety of operations to each schema (model), such as find
, updateOne
and deleteOne
.
Additionally, bulk operations are used (bulkWrite
), when there are plenty of operations that have to be done simultaneously, like when adding many text files for processing in once.