The server drops the collection specified in $out before it writes to it but this is a good point - I don't know if the server will always do this.