我使用server-json来创建一个假 API,我在 data.json 中有路径“playbook/active”
"playbook/active": [{
"description": "This playbook will install haproxy",
"name": "Testing playbook 3",
"tag": [
"loadbalancer",
"charge"
],
"path": "/etc/ansible/haproxy.yml",
"type": "action",
"id": "4bb107be-9efe-11e9-b3e5-bc5ff4901aa5"
},
{
"path": "google.com",
"description": "This is the playbook before execution",
"tag": [
"webserver",
"tomcat"
],
"id": "faa746b4-9cb7-11e9-9b94-bc5ff4901aa5",
"name": "mysql"
}
]
Run Code Online (Sandbox Code Playgroud)
但我有这个错误
错误:哎呀,在数据库属性“playbook/active”中找到/字符。
我更改为“playbook/active”但同样的错误
这是我的代码
const products =
[
{
"id": 1,
"title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
"body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto",
"coefficient":2,
"price": () => 2000 * this.coefficient
},
{
"id": 2,
"title": "qui est esse",
"body": "est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui …Run Code Online (Sandbox Code Playgroud) 我使用 $project 操作来指定包含的字段我有以下代码:
[{
'$lookup': {
'from': 'users',
'localField': 'owner',
'foreignField': 'id'
'as': 'user'
}
}, {
'$project': {
'userName': '$user.username',
'userId': '$user.id'
}
}]
Run Code Online (Sandbox Code Playgroud)
我的结果如下:
[
{
"userName": [
"jscode"
],
"userId": [
"5d1888d60c627764aabd8b1e"
]
}
]
Run Code Online (Sandbox Code Playgroud)
我需要将userId和userName结果从数组转换为字符串, 如下所示:
[
{
"userName": "jscode" ,
"userId": "5d1888d60c627764aabd8b1e"
}
]
Run Code Online (Sandbox Code Playgroud)
谢谢 :)
我想在 js 中验证以下代码,以便用户必须检查一个,但我不知道如何。表格名称是“注册”
<li>
<input type="checkbox" name="en" value="en" />
<span>English</span>
</li>
<li>
<input type="checkbox" name="nonen" value="noen" />
<span>Non English</span>
</li> Run Code Online (Sandbox Code Playgroud)
有没有办法让约束在雪花中实际工作?
创建主键。仍然可以在表中插入重复项。提供级联更新和删除级联等选项不适用于外键
有人可以帮忙吗?
我想创建一个函数,允许比较某些元素, accélérer, Accelerer, ACCELERER...etc 并返回True作为结果(如果我们具有相同的基本字母)。
例:
compare('accélérer','ACCELERER') // will be true
compare('accélérer','accelerer') // will be true
compare('accélérer','test') // will be false
Run Code Online (Sandbox Code Playgroud)
谢谢
javascript ×4
angular ×1
css ×1
html ×1
json-server ×1
mongodb ×1
mongoose ×1
node.js ×1
object ×1