nodebb-plugin-write-api Updates a user's profile information have Bug?



  • Hello everyone
    I have problem, I use nodebb-plugin-write-api perform user update operations, curl -X PUT -H "Authorization: Bearer d1a81c3f-b0d4-4bc1-a307-dbed9aa5fb3e" --data "username=修改用户名测试" http://localhost:4567/api/v1/users/28 is can't success in mongodb .
    Terminal prompt it is

    {
        "code": "ok",
        "payload": {}
    }
    

    But my mongod datas was garbage,
    Like this ⬇️
    mongodb data

    /* 3146 */
    {
        "_id" : ObjectId("599e70c125bd5e96bac844ad"),
        "_key" : "user:undefined",
        "website" : "https://github.com/cdscawd/nodebb-plugin-write-api/blob/master/routes/v2/readme.md",
        "userslug" : "修改用户名测试",
        "username" : "修改用户名测试",
        "email" : "sdfsd@dsfd.com",
        "email:confirmed" : 0,
        "fullname" : "dsferfer"
    }
    
    

    I have UID 28, But why mongod _key is user:undefined



  • @julian Other API are OK, only this have problem



  • This data wasn't update

    
    /* 3132 */
    {
        "_id" : ObjectId("599e6ec025bd5e96bac84286"),
        "_key" : "user:28",
        "username" : "gastby",
        "userslug" : "gastby",
        "email" : "111111@sd",
        "joindate" : 1503555264607.0,
        "lastonline" : 1503555264607.0,
        "picture" : "",
        "fullname" : "",
        "location" : "",
        "birthday" : "",
        "website" : "",
        "signature" : "",
        "uploadedpicture" : "",
        "profileviews" : 0,
        "reputation" : 0,
        "postcount" : 0,
        "topiccount" : 0,
        "lastposttime" : 0,
        "banned" : 0,
        "status" : "online",
        "uid" : 28
    }
    


  • 	User.updateProfile = function (uid, data, callback) {
    		var fields = ['username', 'email', 'fullname', 'website', 'location',
    			'groupTitle', 'birthday', 'signature', 'aboutme'];
    
    		var updateUid = data.uid;
    		var oldData;
    
    		console.log(uid)  //28
    		console.log(updateUid) //undefined
    

    0_1503564280628_WX20170824-164253@2x.png

    curl -X PUT -H  "Authorization: Bearer d1a81c3f-b0d4-4bc1-a307-dbed9aa5fbe" --data "uid=28&username=修改用户名测试" http://localhost:4567/api/v1/users/28
    {
        "code": "ok",
        "payload": {}
    }
    
    "uid=28&username=修改用户名测试" 
    

    The problem is solved!(是我的问题还是文档的问题???)@julian


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.