0

const merkleTreeSchema = mongoose.Schema({
    merkleTree: [
        [{
        type:String,
        required:[true,'Please Send A MekleTree'],
    }],
],
    merkleRoot:[{
        type:String,
        required:[true,'Please Send a MerkleRoot'],
    }]
},{
    timestamps:true,
},
);
MerkleTree.find({merkleTree:{$elemMatch:{hashedPdf}}});

have been trying to query using multiple things, it returns [] or if I just put

MerkleTree.find({hashedPdf});

it return all the documents

Charbel B.G.
  • 151
  • 8
  • Here is the similar discussion about :- [**Mongoose schema correctly with 2d index**](https://stackoverflow.com/questions/19695058/how-to-define-object-in-array-in-mongoose-schema-correctly-with-2d-geo-index) – DSDmark Oct 26 '22 at 04:46
  • Thanks Man, I fixed it by breaking that array into a smaller array, so I can query it. – Charbel B.G. Oct 26 '22 at 06:24
  • What was the value of `hashedPdf`? What did a sample document look like that was or wasn't getting returned? – user20042973 Oct 26 '22 at 14:32

0 Answers0