Collection API

The examples assume arango is a ̀ArangoClient[IO].

  • list collections
arango.db.collections().unsafeRunSync()
// res1: ArangoResponse[Vector[CollectionInfo]] = ArangoResponse(
//   header = Header(
//     version = 1,
//     type = ResponseFinal,
//     responseCode = 200,
//     meta = Map("X-Arango-Queue-Time-Seconds" -> "0.000000")
//   ),
//   body = Vector(
//     CollectionInfo(
//       id = "105",
//       name = CollectionName(repr = "_graphs"),
//       status = Loaded,
//       type = Document,
//       isSystem = true,
// ...
  • create collection
arango.db.collection(CollectionName("temp")).create().unsafeRunSync()
// res2: ArangoResponse[CollectionInfo] = ArangoResponse(
//   header = Header(
//     version = 1,
//     type = ResponseFinal,
//     responseCode = 200,
//     meta = Map("X-Arango-Queue-Time-Seconds" -> "0.000000")
//   ),
//   body = CollectionInfo(
//     id = "228",
//     name = CollectionName(repr = "temp"),
//     status = Loaded,
//     type = Document,
//     isSystem = false,
//     globallyUniqueId = "h77741099B0B1/228"
//   )
// )
  • delete collection
arango.db.collection(CollectionName("temp")).drop().unsafeRunSync()
// res3: ArangoResponse[DeleteResult] = ArangoResponse(
//   header = Header(
//     version = 1,
//     type = ResponseFinal,
//     responseCode = 200,
//     meta = Map("X-Arango-Queue-Time-Seconds" -> "0.000000")
//   ),
//   body = DeleteResult(id = "228")
// )
  • get info
arango.db.collection(CollectionName("countries")).info().unsafeRunSync()
// res4: ArangoResponse[CollectionInfo] = ArangoResponse(
//   header = Header(
//     version = 1,
//     type = ResponseFinal,
//     responseCode = 200,
//     meta = Map("X-Arango-Queue-Time-Seconds" -> "0.000000")
//   ),
//   body = CollectionInfo(
//     id = "142",
//     name = CollectionName(repr = "countries"),
//     status = Loaded,
//     type = Document,
//     isSystem = false,
//     globallyUniqueId = "h63C6878674A1/6626358"
//   )
// )