title: Deleting a subdocument by Id in Mongo using node.js
body: <p>I am using nodejs, express, mongo and coffeescript and I have a simple blog post with comments, and I would like to add the possibility to delete a specific comment at any given time. The schema looks like this:</p>
  
  <pre><code>Schema = mongoose.Schema
  
  ArticleSchema = new Schema
    title:
      type: String
      trim: true
      required: true
  
    body:
      type: String
      required: true
  
    createdAt:
      type: Date
      default: Date.now
  
    comments: [
      body:
        type: String
        default : ''
  
      user:
        type: Schema.ObjectId
        ref: 'User'
        required: true
  
      createdAt:
        type: Date
        default: Date.now
    ]
  </code></pre>
  
  <p>Routes for the article are mapped like this:</p>
  
  <pre><code> articles = require '../app/controllers/articles'
   app.get '/', articles.index
   app.get '/articles', articles.manage
   app.get '/articles/new', auth.requiresLogin, articles.new
   app.get '/articles/:articleId', articles.show
   app.get '/articles/:articleId/edit', auth.requiresLogin, articles.edit
  
   app.param 'articleId', articles.article
  </code></pre>
  
  <p>But how do I do something like this to be able to delete a comment?</p>
  
  <pre><code>  app.get '/articles/:articleId/comment/:commentId/delete', auth.requiresLogin, articles.edit
  </code></pre>