MongoDB
 SQL >> Database >  >> NoSQL >> MongoDB

Scrivere sintassi MongoDB con BasicDBObject

Puoi costruire una query con BasicDBObject e l’operatore $and:

DBObject andAll = new BasicDBObject("$and", Arrays.asList(existence, firstNotMatch, secondNotMatch)); table.find(andAll);

Se vuoi una condizione OR, sostituisci $and con $or. Il codice potrebbe richiedere piccoli adattamenti.