old Data get replaced by current data

11 views
Skip to first unread message

Vidya Jejurkar

unread,
Oct 26, 2016, 2:17:00 AM10/26/16
to Couchbase Mobile
Hi everyone i am using couch-base lite concept to store data locally in my android app.this concept is working but i am facing one issue like if i am 2 taking reading from weighing scale offline such as 50kg and 60 kg.when i am trying to test app by making mobile data on i observed 60 kg which is latest reading replace 50 kg.means on my site 60 kg printed two times.

Query query = mDatabase.createAllDocumentsQuery();
query.setAllDocsMode( Query.AllDocsMode.ALL_DOCS );
// query.setAllDocsMode( Query.AllDocsMode.SHOW_CONFLICTS);
QueryEnumerator result = query.run();
System.out.println( "data count from DB" + result.getCount() );
int count = 0;

for (Iterator<QueryRow> it = result; it.hasNext(); ) {
QueryRow row = it.next();
System.out.println( "createAllDocumentsQuery:-" + row.getDocumentId() );
Document docData = mDatabase.getDocument( row.getDocumentId() );
count = count + 1;
System.out.println( "Iteration Count is: " + count );

//Delete all content of database
//docData.delete();
// System.out.println( docData.getProperties() + "device data:-" + docData.getProperty("deviceData").toString());

System.out.println( "retrievedDocument=" + String.valueOf( docData.getProperties() ) );
Map<String, Object> properties = new HashMap<String, Object>();
properties = docData.getProperties();


is my code right? or something is missing?

Jens Alfke

unread,
Oct 31, 2016, 12:08:25 PM10/31/16
to mobile-c...@googlegroups.com

On Oct 25, 2016, at 11:05 PM, Vidya Jejurkar <jejurka...@gmail.com> wrote:

Hi everyone i am using couch-base lite concept to store data locally in my android app.this concept is working but i am facing one issue like if i am 2 taking reading from weighing scale offline such as 50kg and 60 kg.when i am trying to test app by making mobile data on i observed 60 kg which is latest reading replace 50 kg.means on my site 60 kg printed two times.

I’m having trouble understanding this. Can you post a detailed series of steps that show what you do and what happens?

—Jens
Reply all
Reply to author
Forward
0 new messages