Comparing version 3.3.1 to 3.4.0
@@ -22,2 +22,10 @@ import { Collection, DeleteWriteOpResultObject } from 'mongodb'; | ||
/** | ||
* Find multiple documents by a list of ids | ||
* | ||
* @param {string[]} ids | ||
* @returns {Promise<T[]>} | ||
* @memberof MongoRepository | ||
*/ | ||
findManyById(ids: string[]): Promise<T[]>; | ||
/** | ||
* Finds a record by a list of conditions | ||
@@ -24,0 +32,0 @@ * |
@@ -29,2 +29,18 @@ "use strict"; | ||
/** | ||
* Find multiple documents by a list of ids | ||
* | ||
* @param {string[]} ids | ||
* @returns {Promise<T[]>} | ||
* @memberof MongoRepository | ||
*/ | ||
async findManyById(ids) { | ||
const collection = await this.collection; | ||
const found = await collection.find({ _id: { $in: ids.map(id => new mongodb_1.ObjectID(id)) } }).toArray(); | ||
const results = []; | ||
for (const result of found) { | ||
results.push(await this.invokeEvents(Types_1.POST_KEY, ['find', 'findMany'], this.toggleId(result, false))); | ||
} | ||
return results; | ||
} | ||
/** | ||
* Finds a record by a list of conditions | ||
@@ -31,0 +47,0 @@ * |
{ | ||
"name": "mongtype", | ||
"version": "3.3.1", | ||
"version": "3.4.0", | ||
"description": "Mongo Repository for Node written in TypeScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41936
771