balderdashy / balderdashy/sails
Sails 1.0 not support mongodb update statement with nested field
- Dominant language
- JavaScript
- Stars
- 22.8k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
**Sails version**: 1.02
**Node version**: v8.11.3
**NPM version**: 6.2.0
**DB adapter name**: sails-mongo
**DB adapter version**: 1.01
**Operating system**: windows/linux
Dear, I have a quesion.
Supposed that I have a **Student** model as below:
**_{
'name': 'student_XLAS28',
'location': {
'city': 'abc',
'country': 'GHJ'
}
}_**
Then, I want to perform some update statements like this:
**_Student.updateOne({'student_id': 'student_XLAS28'}).set({
'student_name': 'ABC',
'location.city': 'xyz'
}).then(updatedStudent => {
// Handle with the returned record
// TODO
}).catch(err => next(err));_**
After running that block of code I saw that the record was not updated in the mongodb database but I was pretty sure this worked with sails version 0.1
I'm not sure this is not supported with sails ORM waterline or not? If it's not supported can I just use the native function for mongodb collection?
Please check this issue.
Contributor guide
Research direction
The issue provides no repository file or test; start by reproducing the Student.updateOne().set() example against the stated Sails, sails-mongo, Node.js, and MongoDB versions. Compare the nested-field update behavior with the expected database result. Done means the reported behavior is resolved or the supported limitation is clearly established.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb, node.js
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100