You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					22 lines
				
				613 B
			
		
		
			
		
	
	
					22 lines
				
				613 B
			| 
											3 years ago
										 | 'use strict'; | ||
|  | 
 | ||
|  | const FindAndModifyOperation = require('./find_and_modify'); | ||
|  | 
 | ||
|  | class FindOneAndDeleteOperation extends FindAndModifyOperation { | ||
|  |   constructor(collection, filter, options) { | ||
|  |     // Final options
 | ||
|  |     const finalOptions = Object.assign({}, options); | ||
|  |     finalOptions.fields = options.projection; | ||
|  |     finalOptions.remove = true; | ||
|  | 
 | ||
|  |     // Basic validation
 | ||
|  |     if (filter == null || typeof filter !== 'object') { | ||
|  |       throw new TypeError('Filter parameter must be an object'); | ||
|  |     } | ||
|  | 
 | ||
|  |     super(collection, filter, finalOptions.sort, null, finalOptions); | ||
|  |   } | ||
|  | } | ||
|  | 
 | ||
|  | module.exports = FindOneAndDeleteOperation; |