I was answered about constructing a MongoDb query
How to code collection find with regex and complex criteria using Java MongoDB driver?
Still the question about a count was unanswered: So for this query how to write an analogous Java code returning count:
db.cache.find({objectKey: { $regex: 'Bos*'}, cacheVersionString:'08/03/15_11:05:09'}).count()