Mongoose - 保存功能什么都不做
Mongoose - Save function does nothing
我正在学习 Mongoose,但在保存用户时出现错误。这是我的 User Model
:
这是我的 route
:
MongoDB
连接是正确的,我在控制台看到了,而Postman
只显示了一个Loading Page..
我不知道为什么它不起作用。
提前致谢!
根据您的解释,在没有更多日志记录数据的情况下,使用 Mongoose 4.4.12,new 这个词可能吗?
https://github.com/Automattic/mongoose/blob/master/examples/schema/schema.js#L14
var mongoose = require('mongoose'),
User = require('./models/users_model');
使用用户:
var user = new User({
courriel: "test1",
password: "test2"
});
我解决了。
我的 MongoDB 连接 url 是:
mongodb://localhost:27017/alexcaron
我刚更新到
mongodb://localhost/alexcaron
我正在学习 Mongoose,但在保存用户时出现错误。这是我的 User Model
:
这是我的 route
:
MongoDB
连接是正确的,我在控制台看到了,而Postman
只显示了一个Loading Page..
我不知道为什么它不起作用。
提前致谢!
根据您的解释,在没有更多日志记录数据的情况下,使用 Mongoose 4.4.12,new 这个词可能吗?
https://github.com/Automattic/mongoose/blob/master/examples/schema/schema.js#L14
var mongoose = require('mongoose'),
User = require('./models/users_model');
使用用户:
var user = new User({
courriel: "test1",
password: "test2"
});
我解决了。
我的 MongoDB 连接 url 是:
mongodb://localhost:27017/alexcaron
我刚更新到
mongodb://localhost/alexcaron