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 |
Is there any way to get the number of opened connections in a pool? | 5 | 462 | Aug 2024 |
BulkWriteError handling in Node.JS | 0 | 99 | Aug 2024 |
Can’t update subdocument | 0 | 31 | Aug 2024 |
MongoDB :: connection error: Client network socket disconnected before secure TLS connection was established | 0 | 121 | Oct 2024 |