我正在使用mongoose为节点创建护照身份验证.我的数据库中没有任何名为"users"的集合.但是在使用下面的架构创建新用户时
var mongoose = require('mongoose');
module.exports = mongoose.model('User',{
id: String,
username: String,
password: String,
email: String,
firstName: String,
lastName: String
});
Run Code Online (Sandbox Code Playgroud)
它会自动创建新的"用户"集合.这怎么可能?
我正在尝试连接 eclipse spring maven 的后端和前端两个独立的项目。我为此添加了依赖项。但是当我在 Homecontroller.java 中写下验证凭证逻辑时,在服务器上运行后它显示了这个异常。请帮助解决它我已经尝试了很多方法,请提出建议。
主控制器.java
package com.yogesh.shoponlinefrontend.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.yogesh.shoponlineback.dao.UserDAO;
import com.yogesh.shoponlineback.model.User;
@Controller
public class HomeController {
@Autowired
UserDAO userDAO;
@RequestMapping("/")
public String homePage() {
System.out.println("Executing the method homePage");
return "home";
}
@RequestMapping("/login")
public ModelAndView showLoginPage() {
ModelAndView mv = new ModelAndView("home");
mv.addObject("msg", "You clicked login link");
mv.addObject("showLoginPage", "true");
return mv;
}
@RequestMapping("/register")
public ModelAndView showRegistrationPage() {
ModelAndView mv = new ModelAndView("home");
mv.addObject("msg", "You clicked Registration …Run Code Online (Sandbox Code Playgroud)