-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to query database? #11
Comments
Can you make sure the collection does actually exist and that your syntax is correct? The
Moreover, the examples have a call to MongoDB's
|
This is my code: if (meteor.isConnected()) {
meteor.loginWithEmail(email, password, new ResultListener() {
@Override
public void onSuccess(String result) {
Log.d(TAG, "Logged in: " + result);
try {
JSONObject login = new JSONObject(result);
String userId = login.getString("id");
String token = login.getString("token");
long expiry = login.getJSONObject("tokenExpires").getLong("$date");
Map<String, Object> user = new HashMap<String, Object>();
user.put("_id", userId);
Object[] queryParams = {user};
meteor.call("/Users/find", queryParams, new ResultListener() {
@Override
public void onSuccess(String result) {
Log.d(TAG, "Call result: " + result);
}
@Override
public void onError(String error, String reason, String details) {
Log.d(TAG, "Error: " + error + " " + reason + " " + details);
}
});
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(String error, String reason, String details) {
Log.d(TAG, "Error: " + error + " " + reason + " " + details);
}
});
} |
Thanks for sharing the code! There's nothing wrong with this library. It's just that Meteor doesn't offer Conceptually, retrieving data via So instead of writing |
how do you handle meteor.call("/Users/find", ...) in server side? |
@isdzulqor as @mwaclawek said above, you can't use meteor.setCallback(new MeteorCallback() {
// ...
@Override
public void onDataAdded(String collectionName, String documentID, String fieldsJson) {
// if documentID exists in the local db, update with the new data
// else insert the new data
}
// ...
}); |
@iahvector so it needs SQLite in your android native, and it needs to parse the JSON? |
Yes, though not necessarily SQLite, you can use any DB available on android. I personally use SQLite with an ORM. Sugar ORM is the easiest, and I'm currently experimenting with FlowDB as it it provides broader functionality. |
@iahvector Thank you so much for sharing this, My english is still bad, so sometimes I feel hard to understanding the documentation of the library,, I will try that,, |
It can be, the guys at collectionFS do it, but I think it is complicated. When I needed to upload a file from android, I created a HTTP POST API for uploading files. |
HTTP POST API with restivus? you use Meteor for server or php when it needs to upload file? |
I use meteor. |
@iahvector would you like to show me the code to make HTTP POST API to upload File like image? because I've implemented the tutorial from google but it's not working, |
Thanks for the interesting discussion, @isdzulqor and @iahvector :) But please try to open new issues for new problems and questions again :) The reason is that your questions and answer may really be helpful for other users and they may more easily find them if they are in separate issues. Thank you! |
how can I call
collection.find()
on android?meteor.call("/Collection/find")
gives 404 despite that it works on the web client.The text was updated successfully, but these errors were encountered: