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 |
---|---|---|---|
Hashing the password with pre saving middleware | 2 | 430 | Dec 2024 |
Title: Troubleshooting MongoDB Atlas Connection Failure with DNS Resolution Error | 1 | 105 | Dec 2024 |
Connection problem on Render only. Error says IP not whitelisted, but it is | 1 | 70 | Jan 2 |
Nextjs stores database responses. How can I request content dynamically? | 0 | 24 | Feb 25 |
Best Approach for Dynamic Custom Collections in a Multi-Tenant Ap | 0 | 19 | Mar 12 |