Automattic / Automattic/mongoose
Cannot add setter on object path
- Dominant language
- JavaScript
- Stars
- 27.5k
- Forks
- 4k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 35
Description
I've got a location field which has nested lat and lng.
I want to set setter for it. mySchema.path('location).set(function(v) {});
But it says that i'm calling 'set' of undefined.
Setters works ok for simple fields. Why I can't use it for nested?
I want to use setter to ensure order of lat and lng fields which is required for mongodb.
Contributor guide
Research direction
No file or test is named. Start by reproducing the nested `location` case through the `mySchema.path(...).set(...)` entry point and compare it with a setter on a simple field; done means the nested setter behavior is supported for preserving `lat` and `lng` order, or the limitation is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100