mongodbmongodb-stitch

MongoDB - Stitch: Can't make custom user data to appear in userObject.customData


When I log with a user the userObject contains empty customData object despite saving a document in custom data collection pointing to the app user.

I tried to follow the documentation:

  1. In the Users section of Mongo Stitch panel I enabled custom data. I chose database, collection (users) and stated User ID Field to be userId. Then I deployed changes.

  2. I have a created and confirmed user.

  3. I copied the user's _id and from shell (from admin account and context of the relevant db) I ran command db.users.insertOne({userId: ObjectId('copied_id'), description: "something"}). It was acknowledged and when I query the collection I see relevant document with userId field having correct ObjectId() value.

  4. I even tried to set read rights to the users collection.

Nonetheless, if I log in with my user, customData object is empty. What can be the cause of this?


Solution

  • same issue here... pebcak :/

    I fixed it by setting userId as String, not ObjectId.

    Hoping it's not too late ;)