javamongodbmongodb-querymongodb-javamongo-jackson-mapper

What package do I need to import for the Jackson mongodb DBquery functions to compile in Java?


I have this query string :

coll.find(and(DBQuery.greaterThanEquals("createdOn", startDate), DBQuery.lessThanEquals("createdOn", endDate),DBQuery.is("user_email",userEmail)));

I am getting the error :

cannot find symbol [symbol: variable DBQuery] [location: class models.food.UserMeal]

Now a plain DB query

coll.find(); is working smoothly. What package am I missing for this to work?

Update :

I tried importing : import org.mongojack.DBQuery; but instead got the error : package org.mongojack does not exist


Solution

  • Accoding to official documentation you should import exactly org.mongojack.DBQuery.

    So your problem is with library dependencies. Obviously you have missed mongojack library, e.g.

    <dependency>
        <groupId>org.mongojack</groupId>
        <artifactId>mongojack</artifactId>
        <version>2.3.0</version>
    </dependency>