Started from version 6.7.0 library has 2 big changes:
MongoRole
andMongoUser
use native MongoBD ObjectId type instead of string.MongoRole
has new propertyClaims
.
According to changes you need to do 2 updates:
- update "_id" from "5e88749c85924566b02855cd" to ObjectId("5e88749c85924566b02855cd") in Users and Roles collections
- add empty array to Roles collection
Lower you can find simple scripts to do this updates.
NOTE!: Before do anything please dump your data.
db.Users.find({_id : {$type : 2}}). //find all _id prop with type string
forEach(function(item){
var oldId = item._id;
var id = ObjectId(oldId); //_id to ObjectId
item._id = id;
db.Users.insert(item);
db.Users.remove({ _id : oldId });
}
)
Then run this script for Roles collection. Simple change Users => Roles (3 places)
MongoDB types
db.Roles.updateMany({}, {$set : {Claims : []}})