I have the following models:
api/models/Lugar.js
module.exports = {
attributes: {
nombre: 'STRING',
descripcion: 'STRING',
coordenadas: 'json',
url_foto: 'STRING',
ruta: {
collection: 'Ruta',
via: 'lugares'
},
tipo: {
collection: 'TipoLugar',
via: 'lugares'
}
}
};
api/models/TipoLugar.js
module.exports = {
attributes: {
nombre: 'STRING',
lugares: {
collection: "Lugar",
via: "tipo"
}
}
};
api/models/Ruta.js
module.exports = {
attributes: {
nombre: 'STRING',
tramos: 'json',
url_tablilla: 'STRING',
lugares: {
collection: "Lugar",
via: "ruta"
}
}
};
I send data:
POST-> http://localhost:1337/tipolugar
POST-> http://localhost:1337/ruta
POST-> http://localhost:1337/lugar
and everything works fine, but when I update a record to make a relationship:
PUT-> http://localhost:1337/lugar/5430c1f36763e3940c0e3578
with(for example): {"tipo": "5430c1e06763e3940c0e3577", "ruta": "5430c1e06763e3940c0e357b" }
in the console I get the following error
/Users/genesis/Documents/Proyectos/como-llegar/node_modules/sails-mongo/node_modules/mongodb/lib/mongodb/connection/base.js:245
throw message;
^
TypeError: Cannot read property 'where' of undefined
at _afterFetchingJunctorRecords (/Users/genesis/Documents/Proyectos/como-llegar/node_modules/sails-mongo/node_modules/waterline-cursor/cursor/populateBuffers.js:131:35)
I'm doing wrong?