我正在尝试使用 Node.js 应用程序中的 SSO 凭证通过 AWS-SDK 访问 AWS 资源。为此,我首先从 AWS CLI 创建了我的 SSO 配置文件,然后尝试在我尝试使用以下方法的应用程序中使用相同的配置文件:
Option1:
const AWS = require("aws-sdk");
const { defaultProvider } = require("@aws-sdk/credential-provider-node");
const route53 = new AWS.Route53({ credentials: defaultProvider({ profile: "my-sso-profile" })});
Option2:
const AWS = require("aws-sdk");
const { fromSSO } = require("@aws-sdk/credential-provider-sso");
const route53 = new AWS.Route53({ credentials: fromSSO ({ profile: "my-sso-profile" })});
Run Code Online (Sandbox Code Playgroud)
我运行时出现以下错误:
Error [CredentialsError]: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
Run Code Online (Sandbox Code Playgroud)
即使我已经使用(setx AWS_SDK_LOAD_CONFIG 1)将环境变量AWS_SDK_LOAD_CONFIG设置为1。我仍然面临同样的问题
我的配置文件位于 users/user/.aws/config ,如下所示:
[profile my-sso-profile]
sso_start_url = https://*******.awsapps.com/start …Run Code Online (Sandbox Code Playgroud) amazon-web-services single-sign-on aws-sdk-nodejs aws-sdk-js
我是小精灵的新手。我试图根据某些条件获得一些随机顶点。但是,如果我使用带有一些数学计算的示例方法,则它不起作用。但是如果我给出整数值,它就可以正常工作。
以下查询工作正常:
g.V().hasLabel('Person').sample(1)
Run Code Online (Sandbox Code Playgroud)
以下查询不起作用:
g.V().hasLabel('Person').sample(math('4/2'))
Run Code Online (Sandbox Code Playgroud)
实际上,根据人数,我应该在样本方法中执行一些数学计算。提前致谢
我是 DocumentDB 的新手。尝试连接两个集合并执行查询、排序和投影等过滤器。
我有两个集合,需要对两个集合执行过滤器,结果应该是一个嵌入列表(其中应包含项目和子项目)。
第一个集合将在 Subitems 字段中保存第二个集合的 id。
这是第一个集合(项目):
{
"_id": 897979789,
"Country": "India",
"State": "XXX",
"Subitems": [ ObjectId("44497979789"), ObjectId("333897979789") ]
},
{
"_id": 987979798,
"Country": "Australia",
"State": "YYY",
"Subitems": [ ObjectId("97979789444"), ObjectId("897979789333") ]
}
Run Code Online (Sandbox Code Playgroud)
这是第二个集合:
{
"_id": 44497979789,
"EmployeeName": "Krishna",
"Occupation": "Engineer",
"ProjectsHandled": [
{
"ProjectName": "Project1"
}
]
},
{
"_id": 333897979789,
"EmployeeName": "krish",
"Occupation": "CTO",
"ProjectsHandled": [
{
"ProjectName": "Project1"
}
]
},
{
"_id": 97979789444,
"EmployeeName": "name",
"Occupation": "CEO",
"ProjectsHandled": [
{
"ProjectName": "Project2"
}
] …Run Code Online (Sandbox Code Playgroud) 我正在使用 Docker 使用 Cassandra(3.11.1) 和 Elastic search(5.6.4) 运行 Janusgraph(0.3.1)。但是,现在我迁移到了最新版本,即(janusgraph:最新,Cassandra:3,弹性搜索:6.6.0)并且我正在运行多个图。这工作正常,但是,我无法使用旧数据。当我尝试挂载旧的 Cassandra 和 Elastic 搜索卷时,我在 Elastic 搜索方面遇到了一些问题。但是,当我使用最新版本和旧卷运行单个图形时,它运行良好。当我尝试使用多个图形时,Janusgraph 无法使用弹性搜索进行配置。
为此,我尝试使用陀螺仪格式(我已经从旧服务器导出)从图形中导入旧数据,而不是安装旧卷。但我也面临这个问题。
我尝试了两种方式,但在这两种方式中,我都面临一些问题。任何帮助将不胜感激
这是我的 docker-compose.yml 文件
version: "3"
services:
janusgraph:
image: janusgraph/janusgraph:latest
container_name: jce-janusgraph
environment:
JANUS_PROPS_TEMPLATE: cassandra-es
janusgraph.storage.backend: cql
janusgraph.storage.hostname: jce-cassandra
janusgraph.index.search.hostname: jce-elastic
volumes:
- /mnt/janusvol/janus/scripts:/opt/janusgraph/tmp/scripts
- /mnt/janusvol/janus/conf/gremlin-server.yaml:/opt/janusgraph/conf/gremlin-server/gremlin-server.yaml
- /mnt/janusvol/janus/conf/empty-sample.groovy:/opt/janusgraph/scripts/empty-sample.groovy
- /mnt/janusvol/janus/conf/janusgraph-cql-es-server-geniegraph.properties:/opt/janusgraph/conf/gremlin-server/janusgraph-cql-es-server-geniegraph.properties
- /mnt/janusvol/janus/conf/janusgraph-cql-es-server-aagraph.properties:/opt/janusgraph/conf/gremlin-server/janusgraph-cql-es-server-aagraph.properties
ports:
- "8182:8182"
networks:
- jce-network
healthcheck:
test: ["CMD", "bin/gremlin.sh", "-e", "scripts/remote-connect.groovy"]
interval: 10s
timeout: 30s
retries: 3
entrypoint:
- bin/gremlin-server.sh
- conf/gremlin-server/gremlin-server.yaml
links:
- cassandra
- elasticsearch
cassandra: …Run Code Online (Sandbox Code Playgroud) elasticsearch gremlin-server cassandra-3.0 janusgraph elasticsearch-6
我的 collection1 在项目字段中保存了 collection2 的 _ids ,如下所示:
{
"name": "adafd",
"employeeId": "employeeId",
"locations": [
"ObjectId(adfaldjf)",
"ObjectId(adfaldjf)",
"ObjectId(adfaldjf)",
"ObjectId(adfaldjf)",
"ObjectId(adfaldjf)",
"ObjectId(adfaldjf)"
]
}
Run Code Online (Sandbox Code Playgroud)
集合2如下
"collection2": [
{
"location": "india",
"states": [
{
"stateCode": "TN",
"districts": {
"cities": [
{
"code": 1,
"name": "xxx"
},
{
"code": 4,
"name": "zzz"
},
{
"code": 6,
"name": "yyy"
}
]
}
}
]
}
]
Run Code Online (Sandbox Code Playgroud)
我试图在查找后过滤 collection2 内的嵌套数组,如下所示:
db.collection.aggregate([
{
$lookup: {
from: "collection2",
localField: "locations",
foreignField: "_id",
as: "locations"
}
},
{
$match: …Run Code Online (Sandbox Code Playgroud) mongodb mongodb-query nosql-aggregation aggregation-framework dynamodb-queries