I must be doing something really stupid and need help to realize that . I am using a simple regex like below to find out all matching documents where short name starts with passed name. Now somehow this does not work as i get out of memory because i suspect all documents are getting returned. I tried to put limit in query but that also has not worked .

results=mongoTemplate.find(Query.query(new Criteria("short_name").regex( "/^" + name +".*/i")), MongoInstrument.class);


Any insights?

Thanks