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