Search code examples
node.jsmongodbmongoosemongoose-schema

Referring manually created collection stored in mongo atlas from node js


i am currently creating a nodejs app that deals with huge data. I created a table(.csv file) in excel and then converted it to to JSON file and added the document to MongoDB Atlas under the collection players. The collection is huge, hence i did not create the collection inside from Node.JS. Now I want to refer to the fields inside the MongoDB collection from my Node.JS application and using it as a model.. how to solve this problem.....


Solution

  • You can just create a mongoose schema and model as you do normally. But, name the model player so that it points to your mongodb's players collection.