Start a new topic
Answered

[Titanium] Kinvey.Users.find is undefined on 3.5.2

Hi,

I'm migrating from version 3.4.4 to 3.5.2 and found a problem querying for users on my db with the newest version.

This is my code:

var u = Kinvey.User.getActiveUser();
var query = new Kinvey.Query().equalTo('friends._id',u._id);
query.notEqualTo('_id', u._id);
var stream = Kinvey.Users.find(query);
stream.subscribe(function onNext(e) {
	//callback(e);
}, function onError(error) {
	console.log(" ****** error: " + JSON.stringify(error));
});

   On 3.4.4 everything just works. With 3.5.2 I get this:

 

{
  "message": "undefined is not an object (evaluating 'Kinvey.Users.find')",
  "line": 1086,
  "column": 30,
  "stack": "my_function_name\n"
}

 Is it something new or a bug?

Thanks!


Best Answer
Carlos,

Apologies for the delay.

Kinvey.Users was removed in 3.5.0 of the core (kinvey-js-sdk) in favor of Kinvey.User. Kinvey.User does not contain a find API but instead is replaced by a lookup API that mirrors the find API. For example the code snippet above would like like the following:

var u = Kinvey.User.getActiveUser();
var query = new Kinvey.Query().equalTo('friends._id', u._id);
query.notEqualTo('_id', u._id);
var stream = Kinvey.User.lookup(query); // This is the change
stream.subscribe(function onNext(e) {
  //callback(e);
}, function onError(error) {
  console.log(" ****** error: " + JSON.stringify(error));
});


We have updated the devcenter code snippets for user discovery to use the correct API
https://devcenter.kinvey.com/titanium/guides/users#lookup



Thakns,
Pranav

 


Answer
Carlos,

Apologies for the delay.

Kinvey.Users was removed in 3.5.0 of the core (kinvey-js-sdk) in favor of Kinvey.User. Kinvey.User does not contain a find API but instead is replaced by a lookup API that mirrors the find API. For example the code snippet above would like like the following:

var u = Kinvey.User.getActiveUser();
var query = new Kinvey.Query().equalTo('friends._id', u._id);
query.notEqualTo('_id', u._id);
var stream = Kinvey.User.lookup(query); // This is the change
stream.subscribe(function onNext(e) {
  //callback(e);
}, function onError(error) {
  console.log(" ****** error: " + JSON.stringify(error));
});


We have updated the devcenter code snippets for user discovery to use the correct API
https://devcenter.kinvey.com/titanium/guides/users#lookup



Thakns,
Pranav

 

Carlos,

Thanks for bringing this to our attention. I have escalated it to engineering and will keep you posted on the progress.

Thanks,
Pranav
MLIBZ-1956

 

1 month and...?

Login or Signup to post a comment