title: Cast to string failed for value
body: <p>I have this problem I'm tired  I can't solve this problem <code>Cast to string failed for value \"{}\" at path \"post\</code></p>
  
  <pre><code>{
    "confirmation": "fail",
    "message": {
      "message": "Cast to string failed for value \"{}\" at path \"post\"",
      "name": "CastError",
      "stringValue": "\"{}\"",
      "kind": "string",
      "value": {
  
      },
      "path": "post"
    }
  }
  </code></pre>
  
  <p>hope you will help me</p>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>    &lt;h1&gt;CreateComment&lt;/h1&gt;
      &lt;form action="/api/comment" method="post"&gt;
        &lt;input type="text" name="post" placeholder="Post" /&gt;&lt;br /&gt;
        &lt;input type="text" name="text" placeholder="Text"&gt;&lt;br /&gt;
        &lt;input type="submit" value"Create" /&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p><strong>Comment.js</strong></p>
  
  <pre><code>var mongoose = require('mongoose')
  
  var CommentSchema = new mongoose.Schema({
    profile: {type: mongoose.Schema.Types.Mixed, default: {}},
    post: {type: String, default:{}},
    text: {type: String, default: ''},
    timestamp: {type:Date, default:Date.now}
  })
  
  module.exports = mongoose.model('CommentSchema', CommentSchema);
  </code></pre>
  
  <p><strong>controllers.js</strong></p>
  
  <pre><code>var Comment = require('../models/Comment')
  var promise = require('bluebird')
  
  module.exports = {
  
    post: function(params, isRaw) {
      return new Promise(function(resolve, reject) {
        Comment.create(params, function(err, comment) {
          if (err) {
            reject(err)
            return
          }
          console.log(comment)
          resolve(comment)
        })
      })
    }
  
  }
  </code></pre>
  
  <p><strong>api.js</strong></p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  var controllers = require('../controllers');
  
  
  router.post('/:resource', function(req, res, next) {
    var resource = req.params.resource;
    var controller = controllers[resource];
  
    if (controller == null) {
      res.json({
        confirmation: 'fail',
        message: 'Invalid Resource'
      })
  
      return
    }
  
    controller.post(req.body, false)
      .then(function(result) {
        res.json({
          confirmation: 'success',
          result: result
        })
      })
      .catch(function(err) {
        res.json({
          confirmation: 'fail',
          message: err
        })
      })
  })
  
  module.exports = router;
  </code></pre>
  
  <p>this all of my codes </p>