As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
I'm bloody new to Kinvey just trying out fetching data from a collection (with some sample records).
I posted a code snippet together that is working fine so far but I just can't find anything in the description HOW to receive/fetch the data from the collection. My sample so far:
var promise = Kinvey.User.login('Tayger', 'tiger1971') .then(function(user) {
// Fetch game data var dataStore = Kinvey.DataStore.collection('games'); var query = new Kinvey.Query();
query.equalTo('gameid', '12345');
var stream = dataStore.find(query);
stream.subscribe(function onNext(entities) { // ... }, function onError(error) { // ... }, function onComplete() { fetch collection data probably here? });
Login works, user is granted to the collection 'games', no error message, ... How can I now fetch/receive the returning data?
Regards
Best Answer
P
Pranav J
said
over 5 years ago
Hello Tayger,
The Kinvey JavaScript Library uses the observable pattern to return data on find operations. APIs that fetch data require the application to register a subscriber that gets invoked when data is available. We use Observables to accomplish this.
The subscribe function accepts three arguments: the first is a function invoked when new data is available, the second is a function invoked on error, and the third is a function invoked when the asychronous process is complete. Please take a look at this link for better understanding. Please try printing 'entities' in onNext function.
You can also transform an observable into a promise. Check this link for doing that. Also, please take a look at our sample app/ project on this link. Starter app to help you get started with building your HTML5 app on the Kinvey Platform
Thanks,
Pranav
Kinvey
1 Comment
P
Pranav J
said
over 5 years ago
Answer
Hello Tayger,
The Kinvey JavaScript Library uses the observable pattern to return data on find operations. APIs that fetch data require the application to register a subscriber that gets invoked when data is available. We use Observables to accomplish this.
The subscribe function accepts three arguments: the first is a function invoked when new data is available, the second is a function invoked on error, and the third is a function invoked when the asychronous process is complete. Please take a look at this link for better understanding. Please try printing 'entities' in onNext function.
You can also transform an observable into a promise. Check this link for doing that. Also, please take a look at our sample app/ project on this link. Starter app to help you get started with building your HTML5 app on the Kinvey Platform
Tayger
Hello
I'm bloody new to Kinvey just trying out fetching data from a collection (with some sample records).
I posted a code snippet together that is working fine so far but I just can't find anything in the description HOW to receive/fetch the data from the collection. My sample so far:
Login works, user is granted to the collection 'games', no error message, ... How can I now fetch/receive the returning data?
Regards
Hello Tayger,
The Kinvey JavaScript Library uses the observable pattern to return data on
find
operations. APIs that fetch data require the application to register a subscriber that gets invoked when data is available. We use Observables to accomplish this.The
subscribe
function accepts three arguments: the first is a function invoked when new data is available, the second is a function invoked on error, and the third is a function invoked when the asychronous process is complete. Please take a look at this link for better understanding. Please try printing 'entities' in onNext function.You can also transform an observable into a promise. Check this link for doing that. Also, please take a look at our sample app/ project on this link. Starter app to help you get started with building your HTML5 app on the Kinvey Platform
Thanks,
Pranav
Kinvey
Pranav J
Hello Tayger,
The Kinvey JavaScript Library uses the observable pattern to return data on
find
operations. APIs that fetch data require the application to register a subscriber that gets invoked when data is available. We use Observables to accomplish this.The
subscribe
function accepts three arguments: the first is a function invoked when new data is available, the second is a function invoked on error, and the third is a function invoked when the asychronous process is complete. Please take a look at this link for better understanding. Please try printing 'entities' in onNext function.You can also transform an observable into a promise. Check this link for doing that. Also, please take a look at our sample app/ project on this link. Starter app to help you get started with building your HTML5 app on the Kinvey Platform
Thanks,
Pranav
Kinvey
-
How do I use Kinvey in my web app?
-
Is it safe to include keys/secrets in my client-side JavaScript app?
-
Why is the activeUser null even though I am logged in?
-
Login does not work even though credentials are valid.
-
Social login doesn’t work.
-
Appending objects to an Array (HTML5 - JS)
-
New to node.js - need bootstrap to downloadfiles from Kinvey
-
Problem with Aggregation/Grouping
-
Internal Server Error using Twitter Sign Up
-
Data Store
See all 315 topics