Shamoon
Shamoon

Reputation: 43491

Searching embedded documents in array with Mongoose / Node.js

enter image description here My Schema and data is shown above. How can I query in Mongoose for all documents where within optedOutPerson where campaign_id contains 6020?

In MongoHub, I'm trying: { 'optedOutPerson.campaign_id': /602/ } and that yields no results.

Thank you, in advance.

Upvotes: 0

Views: 372

Answers (1)

RameshVel
RameshVel

Reputation: 65867

Seems you are storing the campaign id as a ObjectID, try convert to string

Upvotes: 1

Related Questions