How to compare two strings in mongoDB spring data?

后端 未结 1 1523
闹比i
闹比i 2020-12-12 06:41

i\'m trying to compare two string in mongoDB spring Data.
My Code:

@GET
     @Path(\"/reqvolatility\")
     @Produces(MediaType.APPLICATION_JSON)

     p         


        
1条回答
  •  無奈伤痛
    2020-12-12 07:35

    Standard query operations do not compare the values of one field against another. In order to do this, you need to employ the JavaScript evaluation server side which can actually compare the two field values:

    Assuming both fields are ISODate instances

     BasicQuery query = new BasicQuery(
            new BasicDBObject("$where", "this.creationTime.getTime() != this.lastModified.getTime()")
        );
    

    0 讨论(0)
提交回复
热议问题