MongoDB 和 Mongoose - 通过链式调用辅助查询函数来缩小搜索结果

告诉我们发生了什么:
在此详细描述你的问题。

你的项目链接

solution: https://boilerplate-mongomongoose.yongshaw.repl.co/

挑战: MongoDB 和 Mongoose - 通过链式调用辅助查询函数来缩小搜索结果

挑战的链接:
https://boilerplate-mongomongoose.yongshaw.repl.co/_api/query-tools
在解决方案链接里输入挑战的链接
显示[Error: Not Found]
输入项目的链接https://boilerplate-mongomongoose.yongshaw.repl.co/
显示[Error: Person validation failed: phoneNumber: User phone number required, gender: User gender required]

Why did you add phoneNumber to the schema?

我的schema没有完全按项目要求的写,这样做影响提交么?我的代码在本地测试是可以通过的。

Don’t add or change anything beyond the requirements.

If you make something required then the test would need to provide that data which they are not. It might work if it wasn’t set as required, but I see no reason to add or change anything beyond the requirements. That will likely just cause issues with the tests.

如果我提交的是完整路径https://boilerplate-mongomongoose.yongshaw.repl.co/_api/query-tools
结果就是[Error: Not Found]
如果我提交的是根路径https://boilerplate-mongomongoose.yongshaw.repl.co
结果就是[Error: E11000 duplicate key error collection: test.people index: phoneNumber_1 dup key: { phoneNumber: null }]
我把schema改过来了没有phoneNumber属性

It is because you have made the properties in the Schema unique.

I can see you have changed it but you now likely have to delete the collection and start again (that is why you get a duplicate key error).