mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-07-14 13:36:59 +00:00
$set instead of overwriting object
This commit is contained in:
@@ -51,11 +51,13 @@ impl Message {
|
||||
channels.update_one(
|
||||
doc! { "_id": id },
|
||||
doc! {
|
||||
"active": true,
|
||||
"last_message": {
|
||||
"_id": self.id.clone(),
|
||||
"author": self.author.clone(),
|
||||
"short": self.content.chars().take(24).collect::<String>()
|
||||
"$set": {
|
||||
"active": true,
|
||||
"last_message": {
|
||||
"_id": self.id.clone(),
|
||||
"author": self.author.clone(),
|
||||
"short": self.content.chars().take(24).collect::<String>()
|
||||
}
|
||||
}
|
||||
},
|
||||
None
|
||||
@@ -70,10 +72,12 @@ impl Message {
|
||||
channels.update_one(
|
||||
doc! { "_id": id },
|
||||
doc! {
|
||||
"last_message": {
|
||||
"_id": self.id.clone(),
|
||||
"author": self.author.clone(),
|
||||
"short": self.content.chars().take(24).collect::<String>()
|
||||
"$set": {
|
||||
"last_message": {
|
||||
"_id": self.id.clone(),
|
||||
"author": self.author.clone(),
|
||||
"short": self.content.chars().take(24).collect::<String>()
|
||||
}
|
||||
}
|
||||
},
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user