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 |
---|---|---|---|
Use $setWindowFields to group daily users registered by channel | 1 | 147 | Aug 2024 |
How can we design a model structure to store the ratings from different users and show the overall rating in course model | 0 | 18 | Nov 2024 |
MERN stack cannot connect to mongoDB Atlas | 2 | 37 | Nov 2024 |
How to use collection in MQTT onMessage event | 1 | 44 | Dec 2024 |
import mongodb error codes ‘MONGODB_ERROR_CODES ’ in javascript | 0 | 36 | Jan 28 |