Closed z0890142 closed 7 years ago
Thanks for your report!
Can you please use a ResultListener
to check whether your insert is successful?
mMeteor.insert("my-collection", myValues, new ResultListener() {});
Further, please check which collections actually exist in your database:
System.out.println(mMeteor.getDatabase().toString());
Apart from that, in the code that you posted, you probably meant this (unless id
and user1
were indeed declared variables), right?
Query query = mMeteor.getDatabase().getCollection("user").whereEqual("id", "user1");
Since getCollection("user")
did already return null
for you, we don't even have to check the first method call (for a specific document), since there cannot be any document if the collection does not exist at all.
Hope that helps!
Also make sure you've really passed an instance of InMemoryDatabase
to the Meteor
constructor as shown in the README.
Try printing full collections, as you did with mMeteor.getDatabase().getCollection("user")
, to check whether there is any data at all. If there's no data in that collection, it makes no sense to test the queries.
Hello! I insert{id:"user1",password;"1234"} in my collection "user" before now i want to find this data with
Query query = mMeteor.getDatabase().getCollection("user").whereEqual( id, user1 );
but it return null.... So here is my question, did I used the wrong function? and how can i find this data?
By the way,
Collection collection=database.getCollection("user"); return null too ... Why this happened?