Added recursive ObjectId conversion for queries