0.0.19 • Published 1 year ago
vespa-framework v0.0.19
Vespa Framework
Install
$ npm install vespa-framework
$ node node_modules/vespa-framework/src/install.js
$ node app.jsFuncionalidades
Los archivos Stylus que se compilan tienen que incluir en el nombre `-src.styl`import {Db} from 'vespa-framework';
Se puede saber el nombre del Database llamando a Db.dbNameSe puede saber las estadisticas del database haciendo
import {Db} from 'vespa-framework';
Db.getStats().then( (stats) => {
console.log(stats);
});Crud
Es posible utilizar metodos de crud ya escritos
// 1. Crear una clase que extiende de -Crud-
import {Crud} from 'vespa-framework';
class Test extends Crud {
static collectionName = 'test';
}Crud
Test.bulkUpdate(docsUpdate);// En la clase se puede tener acceso a los metodos:
Test.updateOne({foo: 'bar'}).then( (result) => {
console.log(result);
})
Test.getById('66375e986361482741d1c230').then( (doc) => {
console.log(doc);
});
Test.findOne({foo: 'bar'}).then( (doc) => {
console.log(doc);
});
Test.getByQuery({foo: 'bar'}).then( (result) => {
console.log(result);
});
Test.count().then( (result) => {
console.log(result);
});
Test.deleteById('66375e986361482741d1c230').then( (result) => {
console.log(result);
});
const docs = [
{ name: "cake", healthy: false },
{ name: "lettuce", healthy: true },
{ name: "donut", healthy: false }
];
// Prevent additional documents from being inserted if one fails
const options = { ordered: true };
Test.insertMany(docs, options).then( (result) => {
console.log(result);
});0.0.18
1 year ago
0.0.19
1 year ago
0.0.13
1 year ago
0.0.14
1 year ago
0.0.15
1 year ago
0.0.16
1 year ago
0.0.17
1 year ago
0.0.12
2 years ago
0.0.11
2 years ago
0.0.10
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago
0.0.5
2 years ago
0.0.4
2 years ago
0.0.3
2 years ago
0.0.2
2 years ago
0.0.0
2 years ago