Comparing version 0.0.3 to 1.0.3
25
crud.js
class Crud { | ||
constructor(type) { | ||
this.type = type; | ||
constructor(model) { | ||
this.model = model; | ||
} | ||
findAll(query) { | ||
findAll(query, select) { | ||
return new Promise((resolve, reject) => { | ||
this.type.find(query) | ||
.select({ | ||
_id: 0, | ||
__v: 0, | ||
password: 0 | ||
}) | ||
this.model.find(query) | ||
.select(select || {}) | ||
.exec() | ||
@@ -31,9 +27,6 @@ .then((docs) => resolve(docs)) | ||
findOne(query) { | ||
findOne(query, select) { | ||
return new Promise((resolve, reject) => { | ||
this.type.findOne(query) | ||
.select({ | ||
__v: 0, | ||
password: 0 | ||
}) | ||
this.model.findOne(query) | ||
.select(select || {}) | ||
.exec() | ||
@@ -63,3 +56,3 @@ .then((doc) => { | ||
return new Promise((resolve, reject) => { | ||
this.type.findOneAndRemove(query) | ||
this.model.findOneAndRemove(query) | ||
.exec() | ||
@@ -66,0 +59,0 @@ .then((doc) => { |
{ | ||
"name": "easy-crud", | ||
"version": "0.0.3", | ||
"description": "Crud functions to your mongoose models", | ||
"version": "1.0.3", | ||
"description": "Crud functions to your mongoose models with Promises", | ||
"main": "index.js", | ||
"keywords": ["crud", "mongoose", "promises"], | ||
"homepage": "https://github.com/gsasouza/easy-crud", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/gsasouza/easy-crud" | ||
}, | ||
"scripts": { | ||
@@ -12,4 +18,3 @@ "test": "echo \"Error: no test specified\" && exit 1" | ||
"dependencies": { | ||
} | ||
} |
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
2049
1
0
64