| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -8,10 +8,11 @@ import ( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						"go.mongodb.org/mongo-driver/mongo/options" | 
					 | 
					 | 
					 | 
						"go.mongodb.org/mongo-driver/mongo/options" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						"github.com/mainnika/mongox-go-driver/v2/mongox/base" | 
					 | 
					 | 
					 | 
						"github.com/mainnika/mongox-go-driver/v2/mongox/base" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						"github.com/mainnika/mongox-go-driver/v2/mongox/query" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					) | 
					 | 
					 | 
					 | 
					) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					// DeleteArray removes documents list from a database by their ids
 | 
					 | 
					 | 
					 | 
					// DeleteArray removes documents list from a database by their ids
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					func (d *Database) DeleteArray(target interface{}) (err error) { | 
					 | 
					 | 
					 | 
					func (d *Database) DeleteArray(target interface{}, filters ...interface{}) (err error) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						targetV := reflect.ValueOf(target) | 
					 | 
					 | 
					 | 
						targetV := reflect.ValueOf(target) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						targetT := targetV.Type() | 
					 | 
					 | 
					 | 
						targetT := targetV.Type() | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -37,6 +38,7 @@ func (d *Database) DeleteArray(target interface{}) (err error) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						collection := d.GetCollectionOf(zeroElem.Interface()) | 
					 | 
					 | 
					 | 
						collection := d.GetCollectionOf(zeroElem.Interface()) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						opts := options.Delete() | 
					 | 
					 | 
					 | 
						opts := options.Delete() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						ids := primitive.A{} | 
					 | 
					 | 
					 | 
						ids := primitive.A{} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						composed := query.Compose(filters...) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						for i := 0; i < targetLen; i++ { | 
					 | 
					 | 
					 | 
						for i := 0; i < targetLen; i++ { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							elem := targetSliceV.Index(i) | 
					 | 
					 | 
					 | 
							elem := targetSliceV.Index(i) | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -47,7 +49,9 @@ func (d *Database) DeleteArray(target interface{}) (err error) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							return fmt.Errorf("can't delete zero elements") | 
					 | 
					 | 
					 | 
							return fmt.Errorf("can't delete zero elements") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						result, err := collection.DeleteMany(d.Context(), primitive.M{"_id": primitive.M{"$in": ids}}, opts) | 
					 | 
					 | 
					 | 
						composed.And(primitive.M{"_id": primitive.M{"$in": ids}}) | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						result, err := collection.DeleteMany(d.Context(), composed.M(), opts) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						if err != nil { | 
					 | 
					 | 
					 | 
						if err != nil { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							return | 
					 | 
					 | 
					 | 
							return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						} | 
					 | 
					 | 
					 | 
						} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |