I have been working on mongoDb Realm for My Android Application and Web App. So the Inserting Document part while logging in works fine for my android application but gives error in node.js
You’re using MongoDB Atlas client – Have you set up your user with the correct rights to allow for read/write into your collection?
Also, it looks like you’re manually adding the “_id” field to your TaskSchema schema and then generating a BSON Object ID in your newTask function however “_id” and value is automatically created for you when you insert a new document.
Try removing those fields from your schema and function, verify user credentials in your Atlas configuration (for now choose readWriteAnyDatabase) and let me know.
And I am been able to insert document via my Android Application but doesnot permit me to insert through my web application .
And in the user collection data is being added as custom user data, so the id being stored in it is the id created while registering the user.
Do not keep the IP address as 0.0.0.0 when you plan to deploy to production.
The users (or alternatively custom roles), need to be configured on your backend to be permitted to alter databases/collections.