Start a new topic
Answered

DataStore (sync) 'find()' gives not all entries and a null one

Kinvey version: 3.12.1


I have a collection with 12 entries. Doing dataStopre.pull() gives me all 12 entries.

Calling dataStore.find() gives me only two results and one entry has only null values.


My code: 

let dataStore = DataStore<News>.collection(.sync)
        
dataStore.pull() { (result: Result<AnyRandomAccessCollection<News>, Swift.Error>) in
            switch result {
            case .success(let news):
                print("News pulled: \(news.count)")
            case .failure(let error):
                print("Error: \(error)")
            }
            
            dataStore.find() { (result: Result<AnyRandomAccessCollection<News>, Swift.Error>) in
                switch result {
                case .success(let news):
                    print("News found: \(news.count)")
                case .failure(let error):
                    print("Error: \(error)")
                }
            }
        }

The first entry after 'find()' is fine. The second one has only null values.

Is this the reason why I get only 2 entries instead of 12?


The response of 'find()' looks like:

 

(lldb) po Array(news)
▿ 2 elements
  ▿ 0 : News {
	entityId = 5923de61246437c3757b92cf;
	metadata = Metadata {
		lmt = 2017-05-23T07:01:53.561Z;
		ect = 2017-05-23T07:01:53.561Z;
		lrt = 2018-02-09 18:54:40 +0000;
		authtoken = (null);
	};
	acl = Acl {
		creator = kid_-JLW-p6mCx;
		globalRead = (null);
		globalWrite = (null);
		readersValue = (null);
		writersValue = (null);
	};
	title = John Snow;
	text = Nows nothing I guess;
	teaserText = Teases me;
	date = 2017-06-07 22:00:00 +0000;
	time = 1970-01-01 18:00:00 +0000;
}
  ▿ 1 : News {
	entityId = (null);
	metadata = (null);
	acl = (null);
	title = (null);
	text = (null);
	teaserText = (null);
	date = (null);
	time = (null);
}

 



With 3.12.2 the problem is gone and everything looks fine.


Thanks,

Sebastian

Hello Sebastian, 


This behavior sounds related to an issue which we identified in the persistence of the server response to the local database. 


This issue will be addressed, meanwhile you can refer to the version 3.10 and 3.11 which did not produce that behavior. 


Please let me know should you have further questions or considerations. 


Regards,

Anton 

Login or Signup to post a comment