Has anyone have any idea how to use MongoRegex for the document search?
I attempted this, but returns nothing back:
var spec = new Document(); spec.A
you just want a simple prefix query. Your regex is then ^ + searchKey. Also, this form will allow mongodb to use an index on Name.
var spec = new Document("Name", new MongoRegex(string.Format("^{0}",searchKey), "i")); collection.Find(spec)