node-orm2
                                
                                
                                
                                    node-orm2 copied to clipboard
                            
                            
                            
                        Remove method is inconsistent
Node version: 6.4.0 ORM dependency version: 3.1.0 MySQL dependency version: 2.11.1 Database protocol: mysql
The arguments passed to the callback of the remove method are inconsistent. Take a look at the examples below.
When there are no Does in the persons table (zero rows will be deleted):
Person.find({ surname: "Doe" }).remove(function () {
    console.log(arguments);
});
// Outputs
// { 
//     '0': null
// }
When there are 4 Does in the persons table (four rows will be deleted):
Person.find({ surname: "Doe" }).remove(function () {
    console.log(arguments);
});
// Outputs
// { 
//     '0': null, 
//     '1': OkPacket {
//         fieldCount: 0,
//         affectedRows: 4,
//         insertId: 0,
//         serverStatus: 2,
//         warningCount: 0,
//         message: '',
//         protocol41: true,
//         changedRows: 0 
//     }
// }
I think the OkPacket should also be included in the first request (when nothing got deleted). The only thing that should differ from the second reqeust is the "affectedRows", which should be "0".
Why I think this should be fixed: Because it's inconsistent and it's currently not possible to use the "remove" functionality with e.g. async.waterfall. If you take a look at other functions, like "find", "create" or "one", they are consistent and are compatible with async.waterfall.
I wonder how this looks with other databases.
@dxg I just tested the same code using SQLite.
In SQLite an empty array is passed instead of the OkPacket.
Node version: 6.4.0 ORM dependency version: 3.1.0 SQLite dependency version: 3.1.6 Database protocol: sqlite
When there are no Does in the persons table (zero rows will be deleted):
Person.find({ surname: "Doe" }).remove(function () {
    console.log(arguments);
});
// Outputs
// { 
// }
When there are 4 Does in the persons table (four rows will be deleted):
Person.find({ surname: "Doe" }).remove(function () {
    console.log(arguments);
});
// Outputs
// { 
//     '0': null, 
//     '1': []
// }