简体   繁体   中英

how to avoid store data in local database in cloudant

right now when i insert data to cloudant server then it store in local database and cloudant server. but i want it store only at cloudant server not in local database in android.

my library is

compile 'com.cloudant:cloudant-sync-datastore-android:1.1.4'

insert code is

 public Map<String, String> createDocument(Map<String, String> map) {
        DocumentRevision rev = new DocumentRevision();
        rev.setBody(DocumentBodyFactory.create(map));
        try {
            DocumentRevision created = sunDatastore.createDocumentFromRevision(rev);
            return map;
        } catch (DocumentException de) {
            return null;
        }
    }

call back funcation is

public List<BasicDocumentMAP> allTasks() {
        int nDocs = this.sunDatastore.getDocumentCount();
        List<DocumentRevision> all = this.sunDatastore.getAllDocuments(0, nDocs, true);
        List<BasicDocumentMAP> arrayListBasicDocumentMAP = new ArrayList<>();

        // Filter all documents down to those of type Task.
        for (DocumentRevision rev : all) {
            BasicDocumentMAP basicDocumentMAP = new BasicDocumentMAP();
            basicDocumentMAP.setBasicDocumentRevision(rev);
            basicDocumentMAP.setMap(rev.asMap());
            arrayListBasicDocumentMAP.add(basicDocumentMAP);
        }
        if (arrayListBasicDocumentMAP != null)
            return arrayListBasicDocumentMAP;
        else
            return new ArrayList<>();
    }

Please help me and thank you...

The library you are using is a "sync" library, it synchronises data between the server and device. If you only want to save data in the server you should use a "client" library such as java-cloudant on github.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM