-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Milestone
Description
Description / Steps to reproduce / Feature proposal
I have a Publication model that basically describes an entry in a bibliography. I'd like to store the author names for each publication as an array of strings:
export class Publication extends Entity {
// ...
@property.array(String) authors: string[]
// ...
}and a controller like this:
export class PublicationController {
constructor(@repository(PublicationRepository) protected repo: PublicationRepository) {}
@post('/publications')
async createPublication(@requestBody() publication: Publication) {
return await this.repo.create(publication)
}
}Current Behavior
I'm using MongoDB as a data source and the data is not being stored as an array but rather as a single comma-separated string. I've found that if I comment out the authors property in the model, POST a new publication, then turn the authors property back on any subsequent GET /publications will return objects where the authors property is an array.
Expected Behavior
I expect the @property.array(String) to properly insert data as an array in both the database and in responses from the REST API.
See Reporting Issues for more tips on writing good issues
Reactions are currently unavailable