Skip to content

Instantly share code, notes, and snippets.



Last active Aug 29, 2015
What would you like to do?
From 0 to MongoDB in 30 seconds...
# Run the following steps in your terminal...
# make sure you have node and mongo installed
npm install strong-cli
# create a loopback project
slc lb project mongo-example
cd mongo-example
# create a loopback model
slc lb model todo
# tell loopback you want to use mongodb
# add the following to datasources.json
"db": {
"connector": "mongodb",
"url": "mongodb://localhost:27015"
# hit mongodb from node
# add this to app.js
var Todo = app.models.todo;
title: 'install loopback and connect to mongodb',
done: true
# start the app in the background
node app &
# hit mongodb over REST
curl localhost:3000/api/todos
[{"id": 1, "title": "install loopback and connect to mongodb", "done": true}]
# learn more here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.