Comments (10)
Can you please do a fresh npm install
and change body({ links })
to body({ links: [Object] })
?
It should work now.
from bodymen.
I was blocked by this problem too and found my solution here :)
I had a mongo validation error because every field of my body that were objects were rendered as [object Object].
You should add the use case with the :[Object] in your Readme ;)
from bodymen.
Hi, @peteashworth
What is the value of links
(the one you send as argument to body
)?
I guess it's something like:
links: {
type: String
}
If so, you need to change it to:
links: [{
type: Object
}]
from bodymen.
Maybe I should dive deeper to understand the package, but here is what I have currently.
Mongoose Model
links: [{ icon: String, url: String }]
Route
const { ... links } = schema.tree ... router.put('/', body({links})
I tried the type: Object within the route body() which gave me [ '[object Object]' ]
from bodymen.
Oh, I can reproduce it. I'll investigate what is happening. Good catch.
from bodymen.
Cool; Thank you!
from bodymen.
Thanks for the quick fix. Doing as suggested, I can console log the links and its now showing correctly. Saving it into mongo is a different story (back to [object Object]) but willing to bet its with the _.merge().
Thanks again!
from bodymen.
all working. Thank you!
from bodymen.
Yay! 🎉
from bodymen.
Got this issue as well, but finally fixed it here. Would there be another solution to add required checks to the object parameters, maybe?
from bodymen.
Related Issues (9)
- Error with nested properties HOT 14
- Is body-parser really needed? HOT 4
- How to make validations? HOT 1
- A required field should be ignored in case of update HOT 2
- Mongoose, bodymen and pre validate a collection ref HOT 2
- Issue with required field type
- how to make conditional validation using bodymen HOT 1
- Trying to get in touch regarding a security issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bodymen.