use $move

Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
Andrey Platov 2021-10-09 13:35:59 +02:00
parent 8ba32cc38f
commit 901e781803
No known key found for this signature in database
GPG Key ID: C8787EFEB4B64AF0

View File

@ -78,15 +78,10 @@
async function move(to: number) {
client.updateDoc(core.class.SpaceWithStates, core.space.Model, _id, {
$pull: {
states: dragState
}
})
client.updateDoc(core.class.SpaceWithStates, core.space.Model, _id, {
$push: {
$move: {
states: {
$each: [dragState],
$position: to < dragStateInitialPosition ? to : to
$value: dragState,
$position: to
}
}
})