Skip to content

A query to update a field in all documents with a unique id  #5

@GIHAA

Description

@GIHAA
db.collection.updateMany({},[{$set:{unique_id: {$function: {
                        body: function() {
                            return UUID().toString().split('"')[1];
                        },
                        args: [],
                        lang: "js"
                    }}}}])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions