class BindedEntityBson extends BsonRecord[BindedEntityBson]{
override def meta: BsonMetaRecord[BindedEntityBson] = BindedEntityBson
object _id extends ObjectIdField(this)
object suggested extends BooleanField(this){
override def defaultValue: Boolean = false
}
object excluded extends BooleanField(this){
override def defaultValue: Boolean = false
}
}
class Facility extends MongoRecord[Facility] with ObjectIdPk[Facility]{
override def meta: MongoMetaRecord[Facility] = Facility
object codify extends StringField(this, 64)
object bindedServices extends BsonRecordListField(this, BindedEntityBson)
}
Facility.where(_.codify eqs hotel.code) .and(_.bindedServices.subfield(_._id) eqs new ObjectId(service.id)) .findAndModify(_.bindedServices.subfield(_.suggested) setTo service.suggested) .upsertOne(returnNew = true)
Message: com.mongodb.MongoCommandException: Command failed with error 16837: 'cannot use the part (bindedServices of bindedServices.suggested) to traverse the element ({bindedServices: [ { suggested: true, excluded: false, _id: ObjectId('5831abee46e0fb450583090b') } ]})' on server 127.0.0.1:27017. The full response is { "ok" : 0.0, "errmsg" : "cannot use the part (bindedServices of bindedServices.suggested) to traverse the element ({bindedServices: [ { suggested: true, excluded: false, _id: ObjectId('5831abee46e0fb450583090b') } ]})", "code" : 16837 }