Accessing mongodb(mongoose) and then do something with it

So I have a collection foo. I use ajax to access it. In the success portion I have a for loop

function(data){
  for(var i in data){
    var project = data[i]
  }
}

So now the collection is connected to project. How do I access project to get the 'name' so I can print out the names?

console.log(project[1].name)?

EDIT more specifics: How come this does not work?

for(var i=0, i<project.length, i++){
    console.log(project[i].name);
}

It says there is a problem with '<' is says it is an unexpected token.

You can use the Chrome developer tools or Firebug (firefox) to see what values are being returned.

In your "for" loop, write debugger; and the code will break as it iterates over the collection, or use the dev tools to set a break point.

if you want to print this in your html, you can create a div and print your value inside the div.

var div = document.createElement("div");
div.innerHTML = project[1].name;
document.body.appendChild(div);

if you just want to see the value stored in project[1] in javascript use alert(project[1].name).

all honestly i don't see a need to create a "var project", you can just use "data" and skip the for loop