Created
April 2, 2018 20:39
-
-
Save RoyalHunt/b07ea0c71d4c9adf1810f9e30717cf22 to your computer and use it in GitHub Desktop.
update all documents in mongodb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const test = await User.find() | |
test.forEach(async (doc) => { | |
const id = nanoid() | |
await User.update({ _id: doc._id }, { $set: { id } }) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment