application/ JSON
body
-
リンクされた MongoDB Atlas データソースの名前。 これは通常
"mongodb-atlas"
ですが、データソースの作成時に別の名前を選択した場合、アプリでは異なる場合があります。 -
指定されたデータソース内のデータベースの名前。
-
指定したデータベース内のコレクションの名前。
-
ドキュメントに一致するMongoDBクエリフィルター。データAPI がサポートするすべてのクエリ演算子のリストについては、クエリ演算子を参照してください。
-
操作によって返された一致したドキュメントのMongoDBプロジェクション。
-
応答に含める一致するドキュメントの最大数。
-
応答から省略する一致するドキュメントの数。
body
-
リンクされた MongoDB Atlas データソースの名前。 これは通常
"mongodb-atlas"
ですが、データソースの作成時に別の名前を選択した場合、アプリでは異なる場合があります。 -
指定されたデータソース内のデータベースの名前。
-
指定したデータベース内のコレクションの名前。
-
ドキュメントに一致するMongoDBクエリフィルター。データAPI がサポートするすべてのクエリ演算子のリストについては、クエリ演算子を参照してください。
-
操作によって返された一致したドキュメントのMongoDBプロジェクション。
-
応答に含める一致するドキュメントの最大数。
-
応答から省略する一致するドキュメントの数。
POST /アクション/find
curl -s "https://data.mongodb-api.com/app/$CLIENT_APP_ID/endpoint/data/v1/action/find" \
-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": {
"status": "complete"
},
"sort": { "completedAt": 1 },
"limit": 10
}'
リクエストの例
{
"sort": {
"completedAt": 1
},
"limit": 10,
"filter": {
"status": "complete"
},
"database": "todo",
"collection": "tasks",
"dataSource": "mongodb-atlas",
"projection": {
"text": 1,
"completedAt": 1
}
}
リクエストの例
{
"sort": {
"completedAt": 1
},
"limit": 10,
"filter": {
"status": "complete"
},
"database": "todo",
"collection": "tasks",
"dataSource": "mongodb-atlas",
"projection": {
"text": 1,
"completedAt": 1
}
}
応答の例(200)
{
"documents": [
{
"_id": "6193504e1be4ab27791c8133",
"text": "Do the dishes",
"completedAt": "2022-05-16T20:22:01.104Z"
},
{
"_id": "6194604e1d38dc33792d8257",
"text": "Feed the dog",
"completedAt": "2022-05-17T05:12:42.828Z"
}
]
}
応答の例(200)
{
"documents": [
{
"_id": {
"$oid": "6193504e1be4ab27791c8133"
},
"text": "Do the dishes",
"completedAt": {
"$date": {
"$numberLong": "1652732521104"
}
}
},
{
"_id": {
"$oid": "6194604e1d38dc33792d8257"
},
"text": "Feed the dog",
"completedAt": {
"$date": {
"$numberLong": "1652764362828"
}
}
}
]
}
応答の例(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"
}