Skip to content

Commit 62c3975

Browse files
authored
chore(shell-api): Update deprecation messages for collection crud commands MONGOSH-522 (#715)
* chore(shell-api): Update deprecation messages for collection crud commands * chore(shell-api): Remove deprecated findAndModify from warning text See https://github.com/mongodb-js/mongosh/pull/715/files#r591599426
1 parent fe371e2 commit 62c3975

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/shell-api/src/collection.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ export default class Collection extends ShellApiClass {
598598
@serverVersions([ServerVersions.earliest, '3.6.0'])
599599
async insert(docs: Document | Document[], options: BulkWriteOptions = {}): Promise<InsertManyResult> {
600600
printDeprecationWarning(
601-
'Collection.insert() is deprecated. Use insertOne, insertMany or bulkWrite.',
601+
'Collection.insert() is deprecated. Use insertOne, insertMany, or bulkWrite.',
602602
this._mongo._internalState.context.print
603603
);
604604
assertArgsDefined(docs);
@@ -710,7 +710,7 @@ export default class Collection extends ShellApiClass {
710710
@serverVersions([ServerVersions.earliest, '3.2.0'])
711711
async remove(query: Document, options: boolean | RemoveShellOptions = {}): Promise<DeleteResult | Document> {
712712
printDeprecationWarning(
713-
'Collection.remove() is deprecated. Use deleteOne, deleteMany or bulkWrite.',
713+
'Collection.remove() is deprecated. Use deleteOne, deleteMany, findOneAndDelete, or bulkWrite.',
714714
this._mongo._internalState.context.print
715715
);
716716
assertArgsDefined(query);
@@ -737,7 +737,9 @@ export default class Collection extends ShellApiClass {
737737
@returnsPromise
738738
@deprecated
739739
save(): Promise<void> {
740-
throw new MongoshInvalidInputError('Collection.save() is deprecated. Use insertOne, insertMany, updateOne or updateMany.');
740+
throw new MongoshInvalidInputError(
741+
'Collection.save() is deprecated. Use insertOne, insertMany, updateOne, or updateMany.'
742+
);
741743
}
742744

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

0 commit comments

Comments
 (0)