Tagged Questions
0
votes
0answers
12 views
PyMongo Shapely GeoJson Conversion
I am working on fence violation. A tracking device sends a series of co-ords, out of this I need to create a fence with buffer.
I use shapely library for this.
from shapely.geometry import ...
-1
votes
0answers
16 views
Use of Node , Python , NLTK , real time processing
For the first time i am trying to help setup the architecture of a system that needs to handle millions of tweets , provide real time response and also perform some natural language processing.
I ...
0
votes
0answers
36 views
Optimize mongodb query
I've made function to keep tracking active users which have been using my app and see their progress.
My idea was to select time period (e.g 01/Oct/2012 up to 01/Oct/2013), take all users that used ...
-1
votes
0answers
11 views
Django Models file from mongodb collections
One collection Product in mongodb looks as follows..
{
"_id": ObjectId("5284ceaae9cfff79368e1f29"),
"companyId": ObjectId("52674f02bbe782d5528b4567"),
"name": "Apple Juice"
}
What should come ...
0
votes
1answer
21 views
PyMongo: Update, $multi:false, get _id of updated document?
When updating a document in MongoDB using a search-style update, is it possible to get back the _id of the document(s) updated?
For example:
import pymongo
client = pymongo.MongoClient('localhost', ...
0
votes
1answer
26 views
Python C build: “undefined symbol” errror, when code runs using gcc directly
I have a python extension written in c which compiles fine however barfs
ImportError: /path/to/cmongo.so: undefined symbol: json_tokener_parse
When I try to import the module (import cmongo) in ...
0
votes
2answers
27 views
MongoDB with python - two actions in one query
i try to alter an document with 2 operations in one query:
_userstats.update(
{"nick" : nick},
{"$set" : {"online" : True}},
{"$inc" : {"joined" : 1}})
But when i try this, i get en ...
3
votes
1answer
40 views
How do i save data in mongodb with one field as primary key
I have a flask service running which connects to mongodb to save user info. When I want to save a user info I first check whether a user exists with that user name and then will add entry into the ...
0
votes
0answers
21 views
Django mongoengine raw query $in with regex
I'm trying to write a $in query with regex using MongoDB and Django/Mongoengine ODM. I need to execute a query that looks like:
db.ad.find({
'place_id':{'$in': ...
1
vote
0answers
21 views
Aggregation in flask-mongoengine
I'm just staring out with MongoDB and I'm staring an application with flask-mongoengine and I want to aggregate a few documents.
I'm using flask-mongoengine and when trying
class ...
0
votes
1answer
28 views
Can mongodb “upsert” in this way?
I know that in conventional upsert operation of mongodb, if a document exists, mongodb will perform update, otherwise it will do insert. However what I want is: if a document exists, mongodb just ...
0
votes
0answers
53 views
Can Python write to database and Meteor reactively update
Can Python be writing data to a database (mongdb) and have Meteor receive updates of the database writes and update the frontend?
-1
votes
1answer
36 views
MongoDB Flask and pymongo
I try to write a webapp with python framework Flask and MongoDB, using pymongo driver.
I need to get an admin view so I'm being able to edit the data online,
The structure of a collection :
...
-1
votes
2answers
20 views
Python lists from mongodb data
I have a mongodb database which has the tweets (that I collected from the twitter API) stored.For example one entry in my mongodb would be:
{u'text':u'<tweet1data>',u'_id':objectid('67788')}
...
1
vote
2answers
66 views
Using mongo with FLASK and python
I am trying to learn python, mongodb and flask and am using the VERY EXCELLENT blog from Miguel Grinberg who provides a great set of tutorials at blog.miguelgrinberg.com
I got a small RESTful ...
-1
votes
1answer
28 views
unable to pull a mongo document from python using find_one() with a par
Exploring python and mongo and cant sort out what I am doing wrong below
How do I pass a variable to a find_one() record?
The code below works but has the id value hard coded in the find_one() so ...
0
votes
1answer
41 views
MongoDB $sort aggregation
I have data base with user's activities and I'd like to count active users and number of activities that they made for each month, then sort result first by year, and each year sort by month!
I've ...
-1
votes
0answers
16 views
Using NLTK with Mongodb
I have a database with Mongodb and I want to import it into NLTK so I can begin to analyze the text. I found this piece of code but I can't seem to figure out whats going on past connecting to the ...
-1
votes
0answers
49 views
Getting started Elasticsearch, MongoDB and Python
I have a MongoDB as my main DB and I request my data my pymongo for my Django project.
I learnt about Elasticsearch recently and I want to use it to get data from my MongoDB. I found the recent ...
0
votes
1answer
37 views
Network compression for Python / Mongo
I have a Python script that queries a remote MongoDB database. The query results are pretty large (~650MB). But the documents that mongo sends are extremely compressible because they have lots of ...
1
vote
0answers
38 views
Optimizing Pymongo read queries
I have created a huge mongodb database. Following are its stats:
> db.stats() <br/>
{
"db" : "test-sample-db",
"collections" : 3,
"objects" : 30700242,
...
0
votes
1answer
33 views
How to continue reading a Mongodb cursor?
In this simplified example, I have a query that returns 10 documents.
I would like to return the first half (n = 5) to my client first. If he wants to continue reading, he can submit a request and I ...
0
votes
0answers
15 views
pymongo remove with user defined parameters
I'm trying to build a simple mongodb RESTful API. Client will send JSON data for document removal, which looks like this:
{
"collectionName": "user",
"data": {
"field": "fname",
...
0
votes
1answer
50 views
Tweepy syntax and Twitter streaming api
So far I have the following code that works and inserts the tweets into my mongodb but I had a few questions.
class CustomStreamListener(tweepy.StreamListener):
def __init__(self, api):
self.api ...
0
votes
1answer
31 views
How to map reduce the friends search in mongodb
I have a friend list (list of object ids), and a search query. I want to search my friends whose first name is starting like the search query. I can see I need to use map/reduce, but I don't think of ...
0
votes
1answer
13 views
Why doesn't mongoengine ReferenceField create an index
I was under the belief that ReferenceField in MongoEngine also creates an index for this field. As MongoEngine inherits a lot from the Django ORM style, and it creates an index for its ForeignKeys.. I ...
0
votes
2answers
18 views
pymongo adds the _id field to my dictionary on insertion
Consider this example:
f = {'a': 'b'}
col.insert(f)
print f
, where col is a mongodb collection.
The above code will print something among the lines of:
{'a': 'b', '_id': ...
0
votes
1answer
18 views
Mongoengine - Embedded document filtering
I am working on Project model with Participants as embedded documents. Following is th structure in which it is stored.
{ "_id" : ObjectId( "5277a15c2d6d1302a2a9bf88" ),
"code_certified" : true,
...
0
votes
1answer
31 views
Is it possible to sort a mongodb array of subdocuments straight with pymongo?
I don't need to sort the returned documents (objects) but an array each of them based on a nested value.Is it something doable with pymongo.sort()?
Assuming an object is:
{ //document data,
array ...
2
votes
1answer
40 views
MongoDB many small uploads vs one large upload
I'm using a MongoDB for storing data. I'm putting in data that is chunked nicely, but could also be easily combined into one large chunk and pushed all in one go.
Is there an advantage to pushing all ...
4
votes
2answers
55 views
Pymongo find by _id in subdocuments
Assuming that this one item of my database:
{"_id" : ObjectID("526fdde0ef501a7b0a51270e"),
"info": "foo",
"status": true,
"subitems : [ {"subitem_id" : ObjectID("65sfdde0ef501a7b0a51e270"),
...
0
votes
0answers
26 views
Can't import name LOOK_SEP while implementing django-mongodb-engine
Here is what I have done so far,
1) I installed Django, and started a project using:
django-admin.py startproject helloworld
2) I downloaded django non-rel, djangotoolbox and django-mongodb-engine
...
0
votes
1answer
46 views
how to break recursive function
I am using instagram API, and this is my code;
from instagram.client import InstagramAPI
api = InstagramAPI(access_token='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
tagname = 'naturelover'
photo_urls = []
...
0
votes
1answer
26 views
Monitoring mongoDB in the cluster
I'm trying to monitor and analyze the results of sharded MongoDB instance in the cluster. There's a nice monitoring tool provided by mongo- MMS. However, I need to analyze and plot CPU/Disk IO, shard ...
1
vote
1answer
27 views
query and insert simultaneously to a mongodb collection
What will happen to query and insert simultaneously to a mongodb collection.
For example,
process-I:
for page in coll.find():
# access page
process-II:
for page in gen_pages():
# ...
0
votes
2answers
33 views
Optimize double loop//make selection in python or mongodb
I have a structure
locations : { //info,
"events" :[ { //data
"displayed" : True},
{ //data
"displayed" : ...
1
vote
2answers
45 views
JSON serializing Mongodb
I am using the python package pymongo to retrieve data from a mongodb database.
>>> r = collection.find() # returns an object of class 'Cursor'
Then I convert to a list
>>> l = ...
1
vote
2answers
64 views
get list of all mongodb database using python [closed]
How do I get list all MongoDB databases and collections for individual databases using python only(Without using any of mongo API)
Any help would be appreciated.
2
votes
1answer
27 views
Pymongo Updating Differently than Mongo Shell
While using Pymongo for updates, I do not get a result (or an error) that I get if I drop the same query into a shell, where db=blog
In the shell, this works:
db.posts.update(
{'permalink': ...
1
vote
0answers
41 views
syncdb not working in Django nonrel using django_mongodb_engine
I have Django-nonrel(1.3), django toolbox and django mongodb engine installed and working. However, when I try to syncdb I get an error:
...django/db/models/fields/subclassing.py", line 28, in inner
...
-2
votes
2answers
55 views
IndexError: 'list index out of range'
I am running this code.
import tweetstream
import csv
twitterUsername = "USERNAME"
twitterPassword = "PASSWORD"
twitterWordFilter = [] #Defined the list
wordListCsv = ...
0
votes
1answer
103 views
Folder Structure for Python Django-REST-framework and Angularjs
I am going to start one project in which i am going to use pyhon django with rest framework, AngularJs with restangular and Mongodb. Should I just start writing my client side application with ...
0
votes
1answer
29 views
pymongo: Advantage of using MongoReplicaSetClient?
It seems that both MongoClient and MongoReplicaSetClient can connect to mongo replica sets. In fact, their documentation pages are nearly identical - same options, same methods, etc - except that the ...
0
votes
1answer
18 views
pymongo db.collection.update operationFailure
I have a large collection of documents which I'm trying to update using the pymongo.update function. I am finding all documents that fall within a certain polygon and updating all the
points found ...
0
votes
1answer
14 views
Connecting to a MongoDB replica set using Ming
I'm using Python to connect to MongoDB and using Ming (http://merciless.sourceforge.net/tour.html) to keep the data model consistent. It has some nice features that I really like, but unfortunately ...
1
vote
2answers
42 views
How to autoincrement id at every insert in Pymongo?
I am using pymongo to insert documents in the mongodb.
here is code for router.py file
temp = db.admin_collection.find().sort( [("_id", -1)] ).limit(1)
for doc in temp:
admin_id = ...
0
votes
0answers
53 views
No module named xblock.fields on installing edX platform
Im on installing edX platform using this instructions ( http://nkokkos.wordpress.com/2013/10/09/setting-up-edx-platform-on-ubutnu/ ),
I followed; every step successfully, but on ./manage.py lms syncdb ...
0
votes
1answer
35 views
authentication error trying to initiate replica set in pymongo
Trying to initiate a mongodb replica set from a python script, and running into an error with authentication.
from pymongo import MongoClient
ip = 'zzz.zz.zzz.zz'
port = 27017
replica_set = 'yomama'
...
0
votes
1answer
47 views
How to fetch all data quickly from mongodb using indexing field without using limit
I have around ~2 million documents in my database, when i made an query in mongo for which looks like:
db.collection.ensure_index("location")
db.collection.find({"location.name": {"$regex": ...
0
votes
1answer
39 views
PyMongo error: cannot convert value of type to bson
I'm using flask with pymongo, and i have the error:
bson.errors.InvalidDocument
InvalidDocument: cannot convert value of type to bso
My code for this error is:
def ...