不要怂,就是干,撸起袖子干!

finding-1.ejs 591 Bytes
Project.find(123, function(project) {
  // project will be an instance of Project and stores the content of the table entry 
  // with id 123 if such an entry is not defined you will get null
})

Project.find({ title: 'aProject' }, function(project) {
  // project will be the first entry of the Projects table with the title 'aProject' || null
})

Project.findAll(function(projects) {
  // projects will be an array of all Project instances
})

Project.findAll({where: "name = 'A Project'"}, function(persons) {
  // projects will be an array of Project instances with the specified name
})