Characterizing affine schemes via morphisms Are there any results that allow us to characterize affine schemes via morphisms to/from other schemes?
Suppose we have a category $\mathcal{C}$ which is equivalent to $\mathbf{Sch}$, the category of schemes. We do not know anything about the equivalence. We want to find the objects $X \in \mathcal{C}$ such that these objects are equivalent exactly to the affine schemes in $\mathcal{C}$.
Is this possible? If not, can we modify the problem slightly (e.g. replace $\mathbf{Sch}$ with a reasonable subcategory, or assume the existence of some reasonable functors) to get an answer? Or is the impossibility fundamental?
 A: As pointed out in the comments, this answer implies much more: for a category $\mathscr C$ equivalent to $\mathbf{Sch}_{/X}$ for any $X \in \mathbf{Sch}$, there is an explicit formula producing a functor $F_{\mathscr C} \colon \mathscr C \to \mathbf{Sch}$ that only depends on the equivalence type of $\mathscr C$, and such that for $F_{\mathbf{Sch}_{/X}} \colon \mathbf{Sch}_{/X} \to \mathbf{Sch}$ is naturally isomorphic to the forgetful functor (in an explicit way).
In particular, if $\mathscr C$ is equivalent to $\mathbf{Sch}$ (the case $X = \operatorname{Spec} \mathbf Z$), this gives an explicit equivalence $F \colon \mathscr C \stackrel\sim\to \mathbf{Sch}$ that only depends on $\mathscr C$ up to equivalence. So if you want to know whether an object $X \in \mathscr C$ 'is' affine (say under any equivalence $\mathscr C \stackrel\sim\to \mathbf{Sch}$), it suffices to check that $F(X) \in \mathbf{Sch}$ is affine.
Of course this is not very useful in practice, since the construction of $F$ is a bit involved, and then you still need a criterion to check whether $F(X)$ is affine.
If you restrict to quasi-compact $k$-schemes, then $X$ is affine if and only if the infinite product $X^{\mathbf N}$ exists in $\mathbf{Sch}_{/k}$; see this answer. On the other hand, it is certainly too optimistic to hope that a scheme $X$ is affine if and only if $X^I$ exists for every set $I$. For instance, if we define $X = \coprod_{p \text{ prime}} \operatorname{Spec} \mathbf F_p$, then $X \to \operatorname{Spec} \mathbf Z$ is a monomorphism, so $X^I \cong X$ for any nonempty set $I$. But $X$ is not affine since it is not quasi-compact.
It would be nice to find a clean criterion in general, but this requires some genuine new ideas. I have some thoughts, but in my opinion, this is maybe not the most pressing question in algebraic geometry...
