Skip to content

chore(shell-api): Update deprecation messages for collection crud commands MONGOSH-522 #715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 15, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/shell-api/src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ export default class Collection extends ShellApiClass {
@serverVersions([ServerVersions.earliest, '3.6.0'])
async insert(docs: Document | Document[], options: BulkWriteOptions = {}): Promise<InsertManyResult> {
printDeprecationWarning(
'Collection.insert() is deprecated. Use insertOne, insertMany or bulkWrite.',
'Collection.insert() is deprecated. Use insertOne, insertMany, or bulkWrite.',
this._mongo._internalState.context.print
);
assertArgsDefined(docs);
Expand Down Expand Up @@ -710,7 +710,7 @@ export default class Collection extends ShellApiClass {
@serverVersions([ServerVersions.earliest, '3.2.0'])
async remove(query: Document, options: boolean | RemoveShellOptions = {}): Promise<DeleteResult | Document> {
printDeprecationWarning(
'Collection.remove() is deprecated. Use deleteOne, deleteMany or bulkWrite.',
'Collection.remove() is deprecated. Use deleteOne, deleteMany, findOneAndDelete, or bulkWrite.',
this._mongo._internalState.context.print
);
assertArgsDefined(query);
Expand All @@ -737,7 +737,9 @@ export default class Collection extends ShellApiClass {
@returnsPromise
@deprecated
save(): Promise<void> {
throw new MongoshInvalidInputError('Collection.save() is deprecated. Use insertOne, insertMany, updateOne or updateMany.');
throw new MongoshInvalidInputError(
'Collection.save() is deprecated. Use insertOne, insertMany, updateOne, updateMany, or findAndModify.'
);
}

/**
Expand Down Expand Up @@ -782,7 +784,7 @@ export default class Collection extends ShellApiClass {
@serverVersions([ServerVersions.earliest, '3.2.0'])
async update(filter: Document, update: Document, options: UpdateOptions & { multi?: boolean } = {}): Promise<UpdateResult | Document> {
printDeprecationWarning(
'Collection.update() is deprecated. Use updateOne, updateMany or bulkWrite.',
'Collection.update() is deprecated. Use updateOne, updateMany, findAndModify, or bulkWrite.',
this._mongo._internalState.context.print
);
assertArgsDefined(update);
Expand Down