Use target class when preparing referenced identifiers in query objects
Fix query element preparation for complex identifier values

Tests cover expressions with query operators, hash type identifiers, simple/complex references, and DBRef values.
Do not recursively prepare $ne arguments in queries

This test was expecting the array argument for $ne to be prepared recursively. We should just consider its argument as a single value to prepare.

Note that the tests were invalid use cases. The "groups" reference-many association would hold an array of DBRefs. Comparing an array with an ObjectId against "groups.$id" (after translation) would never yield a match, so the negation would always match.