application/ JSON
body
-
リンクされた MongoDB Atlas データソースの名前。 これは通常
"mongodb-atlas"
ですが、データソースの作成時に別の名前を選択した場合、アプリでは異なる場合があります。 -
指定されたデータソース内のデータベースの名前。
-
指定したデータベース内のコレクションの名前。
-
ドキュメントに一致するMongoDBクエリフィルター。データAPI がサポートするすべてのクエリ演算子のリストについては、クエリ演算子を参照してください。
-
操作によって返された一致したドキュメントのMongoDBプロジェクション。
body
-
リンクされた MongoDB Atlas データソースの名前。 これは通常
"mongodb-atlas"
ですが、データソースの作成時に別の名前を選択した場合、アプリでは異なる場合があります。 -
指定されたデータソース内のデータベースの名前。
-
指定したデータベース内のコレクションの名前。
-
ドキュメントに一致するMongoDBクエリフィルター。データAPI がサポートするすべてのクエリ演算子のリストについては、クエリ演算子を参照してください。
-
操作によって返された一致したドキュメントのMongoDBプロジェクション。
POST /アクション/findOne
curl -s "https://data.mongodb-api.com/app/$CLIENT_APP_ID/endpoint/data/v1/action/findOne" \
-X POST \
-H "apiKey: $API_KEY" \
-H 'Content-Type: application/ejson' \
-H "Accept: application/json" \
-d '{
"dataSource": "mongodb-atlas",
"database": "learn-data-api",
"collection": "tasks",
"filter": {
"text": "Do the dishes"
}
}'
リクエストの例
{
"filter": {
"text": "Do the dishes"
},
"database": "todo",
"collection": "tasks",
"dataSource": "mongodb-atlas",
"projection": {
"text": 1,
"status": 1
}
}
リクエストの例
{
"filter": {
"text": "Do the dishes"
},
"database": "todo",
"collection": "tasks",
"dataSource": "mongodb-atlas",
"projection": {
"text": 1,
"status": 1
}
}
応答の例(200)
{
"document": {
"_id": "6193504e1be4ab27791c8133",
"text": "Do the dishes",
"status": "open"
}
}
応答の例(200)
{
"document": {
"_id": {
"$oid": "6193504e1be4ab27791c8133"
},
"text": "Do the dishes",
"status": "open"
}
}
応答の例(400)
Errornoauthentication が指定された
{
"error": "no authentication methods were specified",
"error_code": "InvalidParameter",
"link": "string"
}
{
"error": "must specify some form of authentication (either email+password, api-key, or jwt) in the request header or body",
"error_code": "MissingParameter",
"link": "string"
}
応答の例(401)
{
"error": "invalid session: error finding user for endpoint",
"error_code": "InvalidSession",
"link": "string"
}