I have a sails app using sails-mongo and mongo db ... in the Database schema I originally named on of the fields 'name', I've since named the same key in other data types 'deviceName'. I would like to rename all of the records so that the field is updated to deviceName but I'm struggling with the best way to go about doing that. I saw an NPM module called migrate ... seem like in might be promising
Asked
Active
Viewed 494 times
2 Answers
0
You can use the $rename
operator in mongodb. Here is the mongodb docs for rename
Update
There are already a great SO post regarding this. Check out this thread.

Community
- 1
- 1

aludvigsen
- 5,893
- 3
- 26
- 37
0
You can use the columnName
property to map a model attribute name to an existing column. So, in your model file:
attributes: {
deviceName: {
type: 'string',
columnName: 'name'
}
...
}

sgress454
- 24,870
- 4
- 74
- 92