Find

List records from specified collection

Finds database records. You can pass projection to return record fields you care about. Also, you can include referenced collections to have all that information in one place.

  1. Ensure that your Project Id and API Key are correct

  2. Ensure that your Service user holds enough permissions to query database collection.

  3. If you use more than one database, please provide ClusterId; otherwise, the default database will be used.

GET - Gets all records from Collection "Companies."

curl --location --request GET 'https://api.codemash.io/v2/db/companies/find' \
--header 'X-CM-ProjectId: 7254937f-ad77-4d00-9b35-c2af7841d21b' \
--header 'Authorization: Bearer ebis52*******yUfrX'

POST - Gets all records from Collection "Companies" where company code is equal to "123"

curl --location --request POST 'https://api.codemash.io/v2/db/companies/find' \
--header 'X-CM-ProjectId: 7254937f-ad77-4d00-9b35-c2af7841d21b' \
--header 'Authorization: Bearer ebis52*******yUfrX' \
--header 'Content-Type: application/json' \
--data-raw '{ "filter": "{ code: 123 }"}'

Check the docs on how to form projections, filters, sorting, paging. Check the docs on how to use references.

Last updated