Skip to content
This repository has been archived by the owner on May 6, 2019. It is now read-only.

Latest commit

 

History

History
37 lines (22 loc) · 939 Bytes

UsageWithService.md

File metadata and controls

37 lines (22 loc) · 939 Bytes

Usage with service

Listing collections

let configuration = MongoLabApiV1Configuration(databaseName: "{DATABASE_NAME}", apiKey: "{API_KEY}")

let service = CollectionService(configuration: configuration, delegate: self)

service.loadCollections()

Listing documents in a collection

let configuration = MongoLabApiV1Configuration(databaseName: "{DATABASE_NAME}", apiKey: "{API_KEY}")

let service = DocumentService(configuration: configuration, delegate: self)

service.loadDocumentsForCollection(Collection("{COLLECTION_NAME}"))

Adding a document in a collection

let configuration = MongoLabApiV1Configuration(databaseName: "{DATABASE_NAME}", apiKey: "{API_KEY}")

let document = Document(payload: {JSON_OBJECT})

let service = DocumentService(configuration: configuration, delegate: self)

service.addDocument(document, inCollection: Collection("{COLLECTION_NAME}"))