Would like a solution specific to this problem.
Would like a solution specific to this problem.
Hello!
1) Use Collection.query instead profile.query and Collection.getCollectionList instead Profile.getCollectionList
2) You pass parameters in request to collection in a wrong way (here is more information http://docs.appery.io/documentation/b... (Database))
3) Do you call default Users collection? You can't call it this way. Here is more information http://docs.appery.io/documentation/b...
How to do I query two collections at once? And then respond with the collection set where the 'id' in the user collection that does not exist in responses collection.
Hi,
If you add a request parameter 'include' where you list connected collections separated by commas. Collection is connected if there is a field of type=pointer points to it.
precode
var userId = request.get("userId");
var usercollection = "Users"
var responsecollection = "https://api.appery.io/rest/1/db/collections/Responses"
try {
var XHRResponse = XHR.send("GET", "https://api.appery.io/rest/1/db/users", {
"headers": {
"X-Appery-Database-Id": "<id>",
"X-Appery-Master-Key": "<key>"
},
"parameters": {
"limit" : '1',
"where": {"user_id": {"$userId" : {"$nin": {"Reponsescollection"}}}}'
//"where": '{"_id":{ "$ne" : {"userId":{"$in": "Responsecollection" }}}}'
}
});
response.success(XHRResponse.body, "text/plain");
} catch (e) {
response.success("message: " + e.message + " ncode: " + e.code); //If something goes wrong error message will appear
}
</pre>/code/pre
precode
var userId = request.get("userId");
var users = XHR.send("GET", "https://api.appery.io/rest/1/db/users");
var responses = request.get("https://api.appery.io/rest/1/db/collections/Responses");
try {
var XHRResponse = XHR.send("GET", "https://api.appery.io/rest/1/db/users", {
"headers": {
"X-Appery-Database-Id": "<id>",
"X-Appery-Master-Key": "<key>"
},
"parameters": {
"inlcude" : "responses",
"limit" : '1',
"where": '{"_id":{ "$ne" : {"userId":{"$in": "responses" }}}}'
Code: Select all
} });
response.success(XHRResponse.body, "text/plain");
} catch (e) {
response.success("message: " + e.message + " ncode: " + e.code); //If something goes wrong error message will appear
}
/code/pre
precode
var userId = request.get("userId");
var responses = request.get("https://api.appery.io/rest/1/db/collections/Responses");
try {
var XHRResponse = XHR.send("GET", "https://api.appery.io/rest/1/db/users", {
"headers": {
"X-Appery-Database-Id": "<id>",
"X-Appery-Master-Key": "<key>"
},
"parameters": {
"inlcude" : "responses",
"limit" : '1',
"where": '{"_id":{ "$ne" : {"userId":{"$in": "responses" }}}}'
Code: Select all
} });
response.success(XHRResponse.body, "text/plain");
} catch (e) {
response.success("message: " + e.message + " ncode: " + e.code); //If something goes wrong error message will appear
}
/code/pre
Hello!
Sorry, not sure I understand what are you trying to do, but looks like you have a few errors in code prevar responses = request.get("https://api.appery.io/rest/1/db/collections/Responses");/preWhat do you want to do with this code? What do you want to pass in where? Please debug your code. Use console.log and Trace tab to see what you have in variables, what requests you send.
ok so I've got two collections
Users [id, username, password, dob, gender, ...]
Responses [id, user_id, recipient_id, state, username, recipient_username, .... ]
All I want done is to get view all the users from (Users Collection) that are not in (Responses Collection) based on the the user_id.
Something like this
"SELECT * FROM 'users' NOT IN (SELECT 'user_id' FROM 'Responses' WHERE 'user_id'= + 'logged_user_Id' +)"
I am a neophyte, just trying to get it work
http://docs.appery.io/documentation/b...
http://docs.appery.io/documentation/b...