Chords service using MongoDB.
Performs operations related to the "Chord" Model in MongoDB (Mongoose)
- Description:
- Chords service using MongoDB. Performs operations related to the "Chord" Model in MongoDB (Mongoose)
- Source:
Requires
Methods
(async, static) filter(filter, limitNum, skip, pageNum) → {Object}
- Description:
- Uses mongoose to get and/or filter chords based on query parameters. This function gets the chords from the database, applies filters and pagination based on query parameters. It also aplies some populates to get the referenced data from 'notes', 'noteId' and 'typeId'.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
filter |
Object | The filter object to aplly on the query. |
limitNum |
Number | The number of results to limit the query to. |
skip |
Number | The number of results to skip for pagination. |
pageNum |
Number | The current page number for pagination. |
Throws:
-
Throws an error if there is an issue with the database.
- Type
- Error
Returns:
- An object containing the filtered chords, total count, current page, and total pages.
- Type
- Object
(async, static) getById(_id) → {Object}
- Description:
- Uses mongoose to get a unique chord by its "_id". This function gets the chords from the database, applies filters and pagination based on query parameters. It also aplies some populates to get the referenced data from 'notes', 'noteId' and 'typeId'.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
_id |
String | The id of the chord to retrieve. |
Throws:
-
Throws an error if there is an issue with the database.
- Type
- Error
Returns:
- An object containing the selected chord data.
- Type
- Object