Interface RemoteMongoDatabase

    • Example

      // Find 20 documents in a collection
      // Note: log in first -- see StitchAuth
      RemoteMongoClient mongoClient = appClient.getServiceClient(RemoteMongoClient.factory, "mongodb-atlas");
      RemoteMongoDatabase db = mongoClient.getDatabase("video");
      RemoteMongoCollection<Document> movieDetails = db.getCollection("movieDetails");
      movieDetails.find().limit(20).forEach(document -> {
          Log.i(TAG, "Got document: " + document.toString());
    • Method Detail

      • getName

        String getName()
        Gets the name of the database.
        the database name
      • getCollection

        <DocumentT> RemoteMongoCollection<DocumentT> getCollection​(String collectionName,
                                                                   Class<DocumentT> documentClass)
        Gets a collection, with a specific default document class.
        Type Parameters:
        DocumentT - the type of the class to use instead of Document.
        collectionName - the name of the collection to return
        documentClass - the default class to cast any documents returned from the database into.
        the collection