Can i index an mixed type in mongo?

so i have a collection schema as follow

  commonFilter: {
    type: mongoose.Schema.Types.Mixed,
  requestid: String,
  userData: mongoose.Schema.Types.Mixed,
  dateTime: {
    type: Date,

and following is an example of commonfilter data,

commonFilter: {
  field1: "as",
  field2: 23,
  field3: ["sa", "re"],
  field4: [{
    as: "as",
    ASA: "as"

I am using an aggregation query that searches based dateTime, requestid, and fields1-3 from common filter,

  1. is it possible to index the commonFilter which is a Mixed Type?
  2. Is there any best practice for indexing the mixed type?

Hi Sagar,
Were you able to get an answer on this? I have run into a similar problem and am very much interested in understanding how/if you have been able to move forward.


Not yet,

Planning to do some experiments this weekend if I don’t get any response from others.