mongodb query on DBRef type
问题 How do I turn this query in a valid mongodb Query in mongodb shell. { 'cars.owner.$ref' : 'users' } cars.owner is a DBRef here, but $ref is invalid I get this error: "$err" : "Positional operator does not match the query specifier." My objective here is to figure out if there are any cars "owned" by different collections then users. 回答1: MongoDB documentation (database-reference) says following: MongoDB applications use one of two methods for relating documents: Manual references where you