Skip to content

Instantly share code, notes, and snippets.

@travispbrown
Last active December 13, 2015 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save travispbrown/4963219 to your computer and use it in GitHub Desktop.
Save travispbrown/4963219 to your computer and use it in GitHub Desktop.
Short example of node.js Express method to GET resource data from MongoDB. This was just a snippet for my blog to illustrate the simplicity of getting data from MongoDB. Assume the data has already been validated, and DynamoDB connection established.
resource.get (req, res) ->
collection.findOne _id:new mongodb.ObjectID req.body.id, (error, object) =>
res.json 200, JSON.stringify object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment