- Stitch >
- MongoDB Atlas >
- Reference >
- MongoDB Actions
collection.deleteOne()¶
On this page
Definition¶
-
collection.
deleteOne
()¶
Remove a single document from the collection based on a query filter.
Usage¶
Example¶
- Functions
- JavaScript SDK
- Android SDK
- iOS SDK
To call the collection.deleteOne()
action from a
Function, get a collection handle with
database.collection()
then call the handle’s
deleteOne()
method.
To call the collection.deleteOne()
action from a JavaScript
SDK, use the RemoteMongoCollection.deleteOne() method.
To call the collection.deleteOne()
action from the
Java/Android SDK, use the RemoteMongoCollection.deleteOne() method.
To call the collection.deleteOne()
action from the
Swift/iOS SDK, use the RemoteMongoCollection.deleteOne() method.
Parameters¶
- Functions
- JavaScript SDK
- Android SDK
- iOS SDK
The collection.deleteOne()
action has the following form:
Parameter | Description |
---|---|
Query Filter query: <document> |
Optional. A standard MongoDB query document that specifies which document to delete. You can use most query selectors except for evaluation, geospatial, or bitwise selectors. If multiple documents match the query, only the first document in sort order or natural order will be deleted. |
The deleteOne() method has the following form:
Parameter | Description |
---|---|
Query Filter query: <document> |
Optional. A standard MongoDB query document that specifies which document to delete. You can use most query selectors except for evaluation, geospatial, or bitwise selectors. If multiple documents match the query, only the first document in sort order or natural order will be deleted. |
The deleteOne() method has the following form:
Parameter | Description |
---|---|
Query Filter query: <document> |
Optional. A standard MongoDB query document that specifies which document to delete. You can use most query selectors except for evaluation, geospatial, or bitwise selectors. If multiple documents match the query, only the first document in sort order or natural order will be deleted. |
The deleteOne() method has the following form:
Parameter | Description |
---|---|
Query Filter query: <document> |
Optional. A standard MongoDB query document that specifies which document to delete. You can use most query selectors except for evaluation, geospatial, or bitwise selectors. If multiple documents match the query, only the first document in sort order or natural order will be deleted. |
Return Value¶
- Functions
- JavaScript SDK
- Android SDK
- iOS SDK
The collection.deleteOne()
action returns a Promise that
resolves to a document that describes the delete operation.
The RemoteMongoCollection.deleteOne() method returns a Promise that resolves to a RemoteDeleteResult object that describes the delete operation.
The RemoteMongoCollection.deleteOne() method returns a Task that resolves to a RemoteDeleteResult object that describes the delete operation.
The RemoteMongoCollection.deleteOne() method returns a StitchResult enum that resolves to a RemoteDeleteResult object that describes the delete operation.
Value | Description |
---|---|
Matched Count result.deletedCount: <integer> result.deletedCount: <integer> result.deletedCount: <Long> result.deletedCount: <Int> |
The number of documents in the collection that were deleted by the delete operation. |