joye-backend-utility 4.0.2 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/database.js +1 -3
- package/package.json +1 -1
package/dist/database.js
CHANGED
|
@@ -62,8 +62,6 @@ class database {
|
|
|
62
62
|
useNewUrlParser: true,
|
|
63
63
|
useUnifiedTopology: true,
|
|
64
64
|
useFindAndModify: false,
|
|
65
|
-
user: config_1.DB_USER || '',
|
|
66
|
-
pass: config_1.DB_PASSWORD || '',
|
|
67
65
|
// autoIndex: false, // True only for development
|
|
68
66
|
};
|
|
69
67
|
const connection = await (0, mongoose_1.createConnection)(url, options);
|
|
@@ -107,7 +105,7 @@ database.findOne = (model, query) => {
|
|
|
107
105
|
return model.findOne(query);
|
|
108
106
|
};
|
|
109
107
|
database.findById = (model, id) => {
|
|
110
|
-
return model.
|
|
108
|
+
return model.findOne({ _id: mongoose_1.Types.ObjectId(id) }).sort({ _id: -1 });
|
|
111
109
|
};
|
|
112
110
|
database.create = (model, payload) => {
|
|
113
111
|
return model.create(payload);
|