Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Short example of node.js Express method to POST resource data into MongoDB. This was just a snippet for my blog to illustrate the simplicity of using MongoDB. Assume the data has already been validated, and MongoDB connection established.

View express-mongodb-post
1 2 3 4
resource.post (req, res) ->
collection.insert req.body, safe:true, (error, data) ->
if !error?
res.end 201
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.