While creating a web app using Flask or FastAPI, there would be a main.py file that basically instantiates and runs everything. I think that is also the right place for the database connections and initialization. So ideally I'd like to have a…
I'm trying to figure out how to use uMongo with Monitor and I am having a problem. I can't get the uMongo document object to return anything other than None and I am sure it's something obvious I just keep overlooking. If anyone has any suggestions…
I am using uMongo with Python 3.0
I have this model:
class Job(Document):
priority = IntField()
I'm using:
jobs = Job.find()
To get all jobs from mongo instance, and I am trying to sort them by priority.. but unfortunely, I can't seem to find…
I would like to perform bulk insert/update with the umongo library in Python. Is there a way to do the bulk update all at once or am I going to run one insert/update job per item to update ?
I'm trying to understand how and why it's so hard to load my referenced data, in unmongo/pymongo
@instance.register
class MyEntity(Document):
account = fields.ReferenceField('Account', required=True)
date = fields.DateTimeField(
…
I'm having some trouble getting relationships fields to work in umongo. Each Document definition is in a separate file.
In this example i have two basic entities, account and target.
each target has a reference to an account.
//…
I'm currently learning MongoDb and creating an app on python. I need to select one random document from user collection using uMongo, I have tried aggregate but it says that umongo have no this function. How can i do that?
I need to get list of model fields like:
@instance.register
class Todo(Document):
title = fields.StringField(required=True, default='Name')
description = fields.StringField()
created_at = fields.DateTimeField()
created_by =…
Let's say I have the following example:
from datetime import datetime
import dill
from pymongo import MongoClient
from umongo import Instance, Document, fields, validate
db = MongoClient().test
instance = Instance(db)
@instance.register
class…