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

153 Views Asked by At

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

2

There are 2 best solutions below

2
Andremoniy On BEST ANSWER

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>
1
José Ricardo Pla On

Mongojack is the dependency

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