// Define FileStatus enum.
const FileStatus = Enum.create({
name: 'FileStatus',
identifiers: ['TEMPORARY', 'PERMANENT'],
});
// Inside schema definition.
status: {
type: FileStatus,
default: FileStatus.TEMPORARY,
},
helpers: {
children() {
// Lấy danh sách tất cả users theo referrerId
const children = User.find({ referrerId: this._id }).fetch()
return children
},
childrenCount() {
return this.children().count()
}
},
behaviors: {
timestamp: {
hasCreatedField: true,
createdFieldName: 'createdAt',
hasUpdatedField: true,
updatedFieldName: 'updatedAt'
}
}
user .children()
is children is not function
{ modified: true }
is implemented in the validate()
function, but I can't find anything in the docs or the code. Is it not implemented? How could I use such a feature? It would greatly benefit the performance of my app
$unset: { temp: '' }
but it seems that Astronomy is not allowing this operation to happen. I'm wondering what the equivalent is. Please that I don't want to set it to false
or null
, I want the field being deleted from my collection. Thanks in advance for your help!