sql >> Base de Datos >  >> NoSQL >> MongoDB

escribir sintaxis mongoDB

    DBObject idMatch = new BasicDBObject("user_id","bc");
    DBObject usernameMatch = new BasicDBObject("user_name",bc);
    DBObject ageMatch = new BasicDBObject("age",2);

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

    //calling  table.find will get you what you wanted.
    table.find(andAll);

Si desea "O" las condiciones, simplemente reemplace $ y con $ o. Tenga en cuenta que el código anterior no se probó correctamente y es posible que deba modificarlo un poco para que funcione.

Tu pregunta no está clara, pero espero haberte ayudado.