search

Home  >  Q&A  >  body text

mongoose how to get all collection

I need to count all the collections in the data. Which collection contains the most data? How to deal with it.
The mongoose I see uses model to process the corresponding collection. There is a large amount of data that has been imported into the database. How do I get the collection?

PHP中文网PHP中文网2830 days ago772

reply all(2)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-17 10:05:06

    Get the list of collections:

    1. Use node-mongodb-native driven listCollections

    http://mongodb.github.io/node...

    2. The connection in Mongoose also inherits the above native driver:

    https://github.com/Automattic...

    mongoose.connection.db.listCollections()

    Contains the largest Collection:

    You need to count and sort by yourself

    For reference.

    Love MongoDB! Have fun!

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-17 10:05:06

    show tables

    reply
    0
  • Cancelreply