Methods
-
getAll( query )
-
Description
Database query to fetch all documents of a collection.Parameters
Name Type Description query
object | void MongoDB query Details
-
createResource( data )
-
Description
Database query to create a document.Parameters
Name Type Description data
object Data to be saved as a document. Details
-
getOneById( id )
-
Description
Database query to find a document by ID.Parameters
Name Type Description id
mongoose.ObjectId MongoDB document ObjectId. Details
-
updateOneByIdService( id, newData )
-
Description
Database query to update a document by ID.Parameters
Name Type Description id
mongoose.ObjectId MongoDB document ObjectId. newData
object Object with fields to be updated in the document. Details
-
deleteById( id )
-
Description
Database query to delete a document by ID.Parameters
Name Type Description id
mongoose.ObjectId MongoDB document ObjectId. Details