Questions tagged [mongokit]

MongoKit framework try to keep its simplicity when you manage mongodb in python. MongoKit was developed to be fast and light with KISS and DRY in mind. MongoKit brings structured schema and validation layer on top of the great pymongo driver.

Documentation: https://github.com/namlook/mongokit/wiki

Source at github: https://github.com/namlook/mongokit

56 questions
0
votes
1 answer

How to filter fields through DBRef using MongoKit?

I want to filter fields to a document containing DBRef when it's fetched. The target filtering fields is a child document had relation using DBRef. I wanna code like this. db.User.find(fields=['_id', 'profile._id', 'profile.text']) The 'profile'…
0
votes
1 answer

Mongokit - Find Last Added Record

Using Mongokit with Python. Having some trouble working out get the last n number of records. Not sure of the syntax Python wants here exactly, but I have: record = collection.find(sort = [{'timestamp': DESCENDING}],limit=10) Which gives me the…
DizzyDoo
  • 1,489
  • 6
  • 21
  • 32
0
votes
1 answer

Interrelated requests MySQL, analogue in MongoDB

Good day dear colleagues, I decided to move some projects from MySQL to MongoDB and faced several difficulties: For example there are two tables in MySQL: Users: CREATE TABLE `testdb`.`users` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY…
ololo
  • 108
  • 1
  • 7
0
votes
1 answer

Mongokit schema index on fields in array

How do I create index on items.id field in this mongokit schema? I tried to creating index on items.id, but it's throwing ValueError: Error in indexes: can't find items.id in structure. structure = { 'items': [{ 'id': int, …
kefeizhou
  • 6,234
  • 10
  • 42
  • 55
0
votes
1 answer

django_mongokit 0.2.6 not working in Django 1.11

I installed django_mongokit 0.2.6, but it's not working in Django 1.11. While run server shows below error, $ python manage.py runserver Try using 'django.db.backends.XXX', where XXX is one of: u'base', u'mysql', u'oracle', u'postgresql_psycopg2',…
Nuju
  • 322
  • 6
  • 17
0
votes
1 answer

"ImportError: No module named ekeet.models" When setting up Pylons with mongokit

I tried setting up a default pylons project to use mongokit as directed here: http://namlook.github.com/mongokit/pylons.html However it gives me the error: >Traceback (most recent call last): File "/usr/bin/paster", line 18, in >command.run() File…
ciferkey
  • 2,064
  • 3
  • 20
  • 28
0
votes
1 answer

An optional dict in the structure with MongoKit

I've got MongoKit structure like this: structure = { ... 'plugin': { 'id': unicode, 'title': unicode, 'description': unicode, ... } However, not all documents will have the plugin key. If they do, I'd like it to be validated…
a paid nerd
  • 30,702
  • 30
  • 134
  • 179
0
votes
0 answers

KeyError in MongoKit when adding nested field to structure

I have the following structure: structure = { 'firstname': basestring, 'lastname': basestring, 'genres': [basestring], 'address': [ {'number': basestring, 'street': basestring, 'town': basestring} ], 'phone': [ …
shaw2thefloor
  • 600
  • 5
  • 20
0
votes
1 answer

Mongokit How do I specify a key in a dict which is in a list as a required field?

I'm using mongokit and I have a structure similar to this in my document. class MyDoc(Document): structure = { 'sections': [{ 'title': unicode, 'description': unicode }] } required_fields = [] I…
CookieEater
  • 2,237
  • 3
  • 29
  • 54
0
votes
0 answers

mongokit not authenticating mongodb replicaset, showing each connection as operation error

while using it in application it shows operation error.. while readWrite, dbOwner and dbAdmin role was defined for the users it shows OperationFailure: database error: not authorized for query on database. pymongo version: 2.6.3 django-mongokit :…
Amit
  • 41
  • 1
  • 6
0
votes
0 answers

Flask MongoLab MongoKit

I have the following code, very simple: from flask import Flask from flask.ext.mongokit import MongoKit, Document from pymongo import Connection from pymongo import collection from pymongo import database from flask.ext.mongokit import MongoKit,…
emraldinho
  • 475
  • 8
  • 23
0
votes
1 answer

Flask with MongoDB using MongoKit to MongoLabs

I am a beginner and I have a simple application I have developed locally which uses mongodb with mongoKit as follows: app = Flask(__name__) app.config.from_object(__name__) customerDB = MongoKit(app) customerDB.register([CustomerModel]) then in…
emraldinho
  • 475
  • 8
  • 23
0
votes
1 answer

How do you do $elemMatch in Mongokit?

I have documents like: { name: 'Nicholas', friends : ['Amy', 'Joe', 'Amanda'] }, { name: 'John', friends : ['Amy', 'Amanda', 'Sam', 'Steve'] }, and I'd like to find all documents where 'Joe' is in the friends array. In Mongo I guess this would…
nickponline
  • 25,354
  • 32
  • 99
  • 167
0
votes
1 answer

Flask-MongoKit find_one()

I'm trying to use Flask-MongoKit as follows (with both attempts to find_one failing): app = Flask('app-name') db = MongoKit(app) db.register([database.Users]) with app.app_context(): print db['users'].find_one() print…
Jacob
  • 1,335
  • 1
  • 14
  • 28
0
votes
1 answer

Flask MongoKit 'Collection' object is not callable

I am following this http://pythonhosted.org/Flask-MongoKit/ as an example I am just trying to get an instance of Document for writing unit test, but it isn't working. Here's the code for test: import unittest from tests import app, db, ctx from…
codefreak
  • 6,950
  • 3
  • 42
  • 51