Skip to content
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

[FEATURE]: add remove property as a special character to the updateMany function #1

Open
Elijah-trillionz opened this issue Oct 4, 2022 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest

Comments

@Elijah-trillionz
Copy link
Owner

This is an optional feature proposal for removing properties from documents with the updateMany function.

For example:

function updateUsers() {
   // data/users.json = { "users": [{ "username": "john_doe", "age": 21, "student": true, "promoted": true }, {"username": "jane_doe", "age": 24, "student": true, "promoted": true }] }
  const res = await users.updateMany({ promoted: true }, { $rem: ['promoted'] }{ updateAll: true });
  console.log(res) // [{ username: 'john_doe', age: 21, student: true }, {username: 'jane_doe', age: 24, student: false }]
}

The value of the $rem special character will be an array of properties to remove from the group of documents.

@Elijah-trillionz Elijah-trillionz added enhancement New feature or request good first issue Good for newcomers hacktoberfest labels Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant