Body
-
The name of a linked MongoDB Atlas data source. This is commonly
"mongodb-atlas"
though it may be different in your App if you chose a different name when you created the data source. -
The name of a database in the specified data source.
-
The name of a collection in the specified database.
-
A MongoDB query filter that matches documents. For a list of all query operators that the Data API supports, see Query Operators.
-
A MongoDB projection for matched documents returned by the operation.
-
A MongoDB sort expression that indicates sorted field names and directions.
-
The maximum number of matching documents to include the in the response.
-
The number of matching documents to omit from the response.
Body
-
The name of a linked MongoDB Atlas data source. This is commonly
"mongodb-atlas"
though it may be different in your App if you chose a different name when you created the data source. -
The name of a database in the specified data source.
-
The name of a collection in the specified database.
-
A MongoDB query filter that matches documents. For a list of all query operators that the Data API supports, see Query Operators.
-
A MongoDB projection for matched documents returned by the operation.
-
A MongoDB sort expression that indicates sorted field names and directions.
-
The maximum number of matching documents to include the in the response.
-
The number of matching documents to omit from the response.
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
}
}
{
"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"
}
]
}
{
"documents": [
{
"_id": {
"$oid": "6193504e1be4ab27791c8133"
},
"text": "Do the dishes",
"completedAt": {
"$date": {
"$numberLong": "1652732521104"
}
}
},
{
"_id": {
"$oid": "6194604e1d38dc33792d8257"
},
"text": "Feed the dog",
"completedAt": {
"$date": {
"$numberLong": "1652764362828"
}
}
}
]
}
{
"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"
}
{
"error": "invalid session: error finding user for endpoint",
"error_code": "InvalidSession",
"link": "string"
}