mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 18:30:15 +01:00
✨ feat: Enhance group search functionality to support multiple group retrieval
This commit is contained in:
parent
24fc57fd01
commit
d3764fd9fe
2 changed files with 16 additions and 18 deletions
|
|
@ -17,14 +17,14 @@ const getGroupById = (groupId, fieldsToSelect = null) => {
|
|||
};
|
||||
|
||||
/**
|
||||
* Search for a single group based on partial data and return a matching group document as a plain object.
|
||||
* Search for a single group or multiple groups based on partial data and return them as plain objects.
|
||||
*
|
||||
* @param {Partial<Object>} searchCriteria - The partial data to use for searching the group.
|
||||
* @param {string|string[]} [fieldsToSelect] - The fields to include or exclude in the returned document.
|
||||
* @returns {Promise<Object|null>} A plain object representing the group document, or `null` if no group is found.
|
||||
* @param {Partial<Object>} searchCriteria - The partial data to use for searching groups.
|
||||
* @param {string|string[]} [fieldsToSelect] - The fields to include or exclude in the returned documents.
|
||||
* @returns {Promise<Object[]>} An array of plain objects representing the group documents.
|
||||
*/
|
||||
const findGroup = (searchCriteria, fieldsToSelect = null) => {
|
||||
const query = Group.findOne(searchCriteria);
|
||||
const query = Group.find(searchCriteria);
|
||||
if (fieldsToSelect) {
|
||||
query.select(fieldsToSelect);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue