You can use the
delete() method to remove
some or all records from a table in a database. The
X DevAPI provides additional methods to use with the
delete() method to filter and order the
records to be deleted.
The example that follows passes search conditions to the
delete() method. All records matching the
condition will be deleted from the city table. In this
example, one record matches the condition.
db.city.delete().where("Name = 'Olympia'")Query OK, 1 item affected (0.01 sec)
To delete the first record in the city table, use the
limit() method with a value of 1.
db.city.delete().limit(1)Query OK, 1 item affected (0.02 sec)
You can delete all records in a table. To do so, use the
delete() method without specifying a search
Use care when you delete records without specifying a search condition. This action will delete all records from the table.