Query Language Snippets
All Snippets
MongoDB
Update
Update a document with $set, $unset, $inc, etc.
db.users.updateOne(
{ name: "Alice" },
{ $set: { age: 29 } }
);
SQL
Update
Update all rows in a table (use with care).
UPDATE employees SET active = 1;
Cypher
Update
Add a label to a node.
MATCH (n:Person)
SET n:Employee;
Cypher
Update
Remove a property from a node.
MATCH (n:Person)
REMOVE n.age;
SQL
Update
Update specific rows in a table.
UPDATE employees SET salary = salary * 1.05 WHERE department = 'Sales';
SeaORM
Update
Update a record using SeaORM.
use sea_orm::{EntityTrait, ColumnTrait, QueryFilter};
let user = Entity::find()
.filter(Column::Name.eq("Alice"))
.one(&db)
.await?;
if let Some(mut user) = user {
user.age = 31;
user.update(&db).await?;
}
Cypher
Update
Update a node's property.
MATCH (n:Person {name: 'Alice'})
SET n.age = 33;