fixed key query extraction for ObjectId keys.