djangosnippets.org: Latest snippets tagged with 'mongodb'https://djangosnippets.org/tags/mongodb/2013-01-03T09:37:14.144420-06:00MongoDB data load
2013-01-03T09:37:14.144420-06:00jose_lpahttps://djangosnippets.org/snippets/2873/<p>This snippet loads data from JSON files into a MongoDB database.</p>
<p>The code is related with the other snippet <a href="http://djangosnippets.org/snippets/2872/">MongoDB data dump</a>.</p>
<p>To get it working, just create a <code>MONGODB_NAME</code> variable in settings, holding the name of your Mongo database. This can be edited to fit more your needs. …</p>
Freely redistributableMongoDB data dump
2013-01-03T09:33:54.695350-06:00jose_lpahttps://djangosnippets.org/snippets/2872/<p>This Django management command just dumps data from a given MongoDB collection into a JSON file.</p>
<p>To get it working, just create a <code>MONGODB_NAME</code> variable in settings, holding the name of your Mongo database. This can be edited to fit more your needs. The snippet requires Pymongo, since it uses …</p>
Freely redistributableTastypie MongoDB Resource
2012-10-04T08:09:15.533081-05:00fatiheriklihttps://djangosnippets.org/snippets/2830/<h1>MongoDB Resource for Tastypie</h1>
<p>Allows you to create delicious APIs for MongoDB.</p>
<h2>Settings</h2>
<pre><code>MONGODB_HOST = None
MONGODB_PORT = None
MONGODB_DATABASE = "database_name"
</code></pre>
<h2>Example of Usage</h2>
<pre><code>from tastypie import fields
from tastypie.authorization import Authorization
from tastypie_mongodb.resources import MongoDBResource, Document
class DocumentResource(MongoDBResource):
id = fields.CharField(attribute="_id")
title = fields.CharField(attribute="title", null=True)
entities = fields.ListField(attribute="entities", …</code></pre>
Freely redistributable