DB Models for Image, Album, based on Data
This commit is contained in:
1 parent
b829885b00
commit
b69c19239e
5 files changed
+106
-16
No files matched your search
@@ -0,0 +1,16 @@
|
||||
async function find(collection, query, {sort, skip, limit}) {
|
||||
const cursor = collection.find(query)
|
||||
|
||||
if (sort) cursor.sort(sort)
|
||||
if (skip) cursor.skip(skip)
|
||||
if (limit) cursor.limit(limit)
|
||||
|
||||
return cursor.toArray()
|
||||
}
|
||||
|
||||
async function findOne(collection, query) {
|
||||
return collection.findOne(query)
|
||||
}
|
||||
|
||||
exports.find = find
|
||||
exports.findOne = findOne
|
||||
Reference in new issue
Block a user