Answer the question
In order to leave comments, you need to log in
Is it possible to use logic when querying the database?
Imagine that there is a document containing two fields type (String) and target (Mixed), which, depending on the type, is represented by one of many different objects.
const a = Schema({ a: Number });
const b = Schema({ b: String });
const doc = Schema({ type: String, target: Schema.Types.Mixed });
// если type имеет значение 'a', то поле target является объектом a и т.д.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question