How do you create a capped collection using mongoose?

后端 未结 3 1406
难免孤独
难免孤独 2021-01-12 03:39

I\'m trying to create a capped collection using Mongoose, however the following creates a collection that is not capped:



        
3条回答
  •  不要未来只要你来
    2021-01-12 04:23

    If non-capped collection already exist then you need to convert it to capped collection using following command.

    db.runCommand({"convertToCapped": "collection_name", size: 100000});
    

    Then you can able to use it with mongoose.

提交回复
热议问题