Tags » Mongo

Membuat Pagination di Flask + MongoDB

Pertama, kita butuh flask extension yang bernama flask-paginate


Kemudian tambahkan baris berikut di route yang mau di-paginasi, misal search result:

from flask_paginate import Pagination, get_page_parameter

def search(keyword):
	page = request.args.get(get_page_parameter(), type=int, default=1)
	per_page = 3
	offset = (page - 1) * per_page
	data = db.product.find({'$text': {'$search': keyword}}, {'score':
		'textScore'}}).sort([('score', {'$meta': 'textScore'})]).skip(offset).limit(per_page)

	pagination = Pagination(page=page,

	keyword_title = keyword.replace('-', ' ').title()
	return render_template("search.html",
	) 46 more words

Installing MongoDB Server on Local LAN

Today I got hold  of an old HP laptop, alongside  an old compaq laptop that had aged out. The HP had still life on it running on Elementary OS with 500 MB RAM (very old, yet smooth so kudos Elementary), so I removed RAM from my compaq and increased Dell RAM to 1 GB… 200 more words

From 0's And 1's

How to easily find slow queries at MongoDB

Enable profiling

First, you have to enable profiling.

> db.setProfilingLevel(1)

Now let it run for a while. It collects the slow queries ( > 100ms) into a capped collections, so queries go in and if it’s full, old queries go out, so don’t be surprised that it’s a moving target. 37 more words

MongoDB Shell Functions - Can we customize ?

While working on MongoDB, I accidentally ran a find() count query incorrectly which resulted in something interesting.

While I wanted to execute db.team.find().count(), I ended up hitting enter key a bit too sooner and resultant query in the mongo shell was  207 more words

#mongodb #nosql

Five Mongo Commands you must know

Once you have connected to mongod in your environment through mongo shell. You want to know about the databases or may be all collection in a particular database. 244 more words


#138 Daily Dose : Convert your MySQL to MongoDB


Never worry about MongoDB syntax again.

Stitch connects to MongoDB, along with all the other data sources your business uses, and streams that data to Amazon Redshift.

24 more words
Daily Dose

MongoDB mapreduce Introduction

What is Map-reduce ?

Map-reduce is a programming model that helps to do operations on big data in parallel to achieve faster results. To understand map reduce go through… 937 more words