mongo-rust-driver
mongo-rust-driver copied to clipboard
call update_many only update one record?
for id in ids {
doc_ids.push((
"_id".to_string(),
Bson::ObjectId(oid::ObjectId::parse_str(id).unwrap()),
));
}
let db = client.database("account");
let collections = db.collection::<Value>(collect);
let filter = Document::from_iter(doc_ids.clone());
let result= collections.update_many(filter.clone(), doc! {"$set":{"to_ack":to_ack}}, None)
.await
.unwrap();
only last record updated!
Hi @adminSxs, thank you for filing this issue! It looks like you're trying to query all documents with _id
values contained in the doc_ids
array; you may want to use the $in
query operator for this purpose. For further questions about using the update operation I'd recommend posting on the MongoDB Community Forum. Feel free to let me know if you have any questions about using the Rust driver!
There has not been any recent activity on this ticket, so we are marking it as stale. If we do not hear anything further from you, this issue will be automatically closed in one week.
There has not been any recent activity on this ticket, so we are closing it. Thanks for reaching out and please feel free to file a new issue if you have further questions.