How to query NOT INLIST operation?

0 votes
Hi,

Could anyone please tell me how to we get the documents which are not matching the criteria in an array?

I see there is an Operator.INLIST, but how do we negate it?

Thanks.
asked Dec 28, 2015 in App42 Cloud API-BaaS by jitesh.h.lalwani (20 points)

1 Answer

0 votes

Hello Hitesh,

Right now, InList for Not operation is not available. We have recorded your request in our product pipeline. However, the timeline is not decided yet. Once the timeline is decided, will let you know the same. If this is a road blocker for you, then you can build a compound query based on ids which you have for NotEquals operator and find your desired result. For example:

We have build a query for those who don't have last name equals to "ShepHertz" & "George":

Query q1 = QueryBuilder.build("lastName", "ShepHertz", Operator.NOT_EQUALS); // Build query q1 for key1 equal to name and value1 equal to Nick
Query q2 = QueryBuilder.build("lastName", "George", Operator.NOT_EQUALS);	// Build query q2 for key2 equal to age and value2 equal to 30	 
Query query = QueryBuilder.compoundOperator(q1, Operator.AND, q2);   	
// Pass aggregated query to finder method below. Similarly you can aggregate more conditions in querying object.   
storageService.findDocumentsByQuery(dbName, collectionName, query, new App42CallBack() {
public void onSuccess(Object response) 
{
	Storage  storage  = (Storage )response;
	System.out.println("dbName is " + storage.getDbName());
	System.out.println("collection Name is " + storage.getCollectionName());
	ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();            
	for(int i=0;i<jsonDocList.size();i++)
	{
		System.out.println("objectId is " + jsonDocList.get(i).getDocId());  
		System.out.println("CreatedAt is " + jsonDocList.get(i).getCreatedAt());  
		System.out.println("UpdatedAtis " + jsonDocList.get(i).getUpdatedAt());  
		System.out.println("Jsondoc is " + jsonDocList.get(i).getJsonDoc());  
	} 
}
public void onException(Exception ex) 
{
	System.out.println("Exception Message"+ex.getMessage());	
}
});  

 

Please check and let us know if it helps.

Regards,

Himanshu Sharma

answered Dec 29, 2015 by hs00105 (2,005 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...