Skip to main content
Hello, welcome to MongoDB Community
Try this:
db.collection.find({
"offers.photos._id": ObjectId("ID_HERE")
});
If anyone will search it, this is the answer:
const result = await this.companyModel.updateOne(
{ 'offers._id': new Types.ObjectId(offerId) },
{ $set: { 'offers.$[].photos.$[x].order': 0 } },
{ arrayFilters: [ { 'x._id': new Types.ObjectId(photoId) } ] }
);
New & Unread Topics
Topic | Replies | Views | Activity |
---|---|---|---|
How to change DB Structure array of ObjectId to Objects without data loss? | 1 | 364 | Jun 2024 |
Working of `$exists: true` vs `$ne: null` with array fields | 3 | 494 | Jul 2024 |
Schema with trim: true is not working on new entries | 0 | 140 | Aug 2024 |
Need help with error? zsh: parse error near ‘&’ | 1 | 258 | Nov 2024 |
Assessing the optimality of using Aggregation Framework to populate references | 1 | 35 | Nov 2024 |