Results 1 to 1 of 1

Thread: Spring Mongo regex space problem

  1. #1
    Join Date
    Aug 2012
    Posts
    2

    Default Spring Mongo regex space problem

    Hello,

    I am using Spring data for MongoDB operation,

    the Critiria is as follows:
    Code:
    Criteria.where("name").regex(searchvalue, "i")
    While performing a search operation , with a search condition that contain
    space in between the results are not getting fetched.
    for example, if I i have 2 values "medicine bills" and "medicine" in the same collection. If I search for medicine, it returns medicine bills(medicine bills is found before medicine in the collection). same way if I have bills and then bill status, bills gets returned when I search for bill status. Please help
    Code:
    Query query = new Query( Criteria.where(propName).regex(value.toString(), "i")); 
    return  template.find(query,some.class);
    Last edited by rrjois.19; Aug 1st, 2012 at 05:03 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •