1

I found here a nice template for a pagination. However, this example is done with SQLlite.

It seems that it is possible to do pagination with flask-mongoengine, flask-mongoalchemy and pymongo.

I created a little code with PyMongo:

from pymongo import MongoClient

#mongod --dbpath /home/mic/databases/

def fill_data(users_no):
    for i in range(users_no):
        doc = {
            '_id': str(i),
            'uname': "name_" + str(i),
        }
        sDB.insert(doc)


if __name__ == "__main__":
    db = MongoClient().test
    sDB = db.users

    fill_data(10)

    users_no = sDB.find().count()

Which of three MongoDB drivers would work best and is most efficient for above Flask template?

user977828
  • 7,259
  • 16
  • 66
  • 117

1 Answers1

0

For a simple operation like that they're extremely likely to do the same underlying command. I can tell you that MongoAlchemy just does a call out to mongo as you would expect to get the count.

Jeff Jenkins
  • 158
  • 1
  • 3