resolving #2519

setting opts.remove to false if opts.upsert resolves to "true"