w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
mongoimport include the time of import
When the documents get created during import, you get a primary key that's created for you called '_id' which has an ObjectId type field. As it turns out the first four bytes of the ObjectId are the timestamp of its creation. So you can sort by _id as a proxy for sort by insert time, in addition various MongoDB drivers provide methods to extract the timestamp from the ObjectId - for example in MongoDB shell: > var o=new ObjectId() > o ObjectId("51ae926b77bf7c394dfe0cc8") > o.getTimestamp() ISODate("2013-06-05T01:20:43Z")

Categories : Mongodb

MONGODB Mongoimport possible speed up?
Since the majority of time is likely spent serializing JSON objects into BSON (native MongoDB format) you will likely get faster import if you can split up your file and have several parallel jobs each running mongoimport with a separate file.

Categories : Mysql

mongodb - mongoimport stopOnError option
The stopOnError explicitly skips the duplicate key error as can be seen from the source at https://github.com/mongodb/mongo/blob/master/src/mongo/tools/import.cpp#L314. I have filed https://jira.mongodb.org/browse/DOCS-1709 to have the documentation specify this.

Categories : Mongodb

Import of one to many relationships to mongodb
You're correct, map-reduce in mongo assumes a key with a single value document - which is why you end up with the documents with just two objects, a key and a (complex, nested) value object. You could write some code to translate your .csv files into .json. Alternatively, here is a bit of a hack. I exported the data (after using the map-reduce process) to json using mongoexport, used sed to unpack the value object, and then imported it back in using mongoimport. If you use pipes, you don't need to save the whole file at any time (sed is a streaming editor). For the example in the other post you referenced, you use this: mongoexport -c users_comments | sed 's/"value" : {//' | sed s/}$// | mongoimport -c user_comments2 This one-liner will duplicate the user_comments collection and sto

Categories : Mongodb

Import .csv file into mongodb
If I understand correctly, you want a document for each unique MISDIN in the first column, with each document having a subdocument for each MISDIN in the second column with which the first MISDIN has incoming/outgoing calls. So, for the data you provided, a document in the collection would look like this: { _id: ObjectId("5237258211f41a0c647c47b1"), MISDIN_mine: 7259555112, call_records: [ { MISDIN_theirs: 774561213, incoming_count: 3, outgoing_count: 4, total_count: 7, is_EE: 1 }, { MISDIN_theirs: 774561214, incoming_count: 4, outgoing_count: 5, total_count: 9, is_EE: 1 } ... ] } Admittedly, I'm not sure what is_EE is supposed to represent, but let's get the rest into place. In order to import the data in the format you want, first add

Categories : Mongodb

How do I import certain columns from a csv file into mongodb?
You might find this question/answer helpful. The OP there was attempting to do the same thing. The mongoimport command doesn't give you the option of skipping fields during the import process, so that would require a full import followed by $unset operations on the fields you intended to omit. Ultimately, that would leave your collection with fragmentation. You would be better served using fgetcsv or str_getcsv in PHP to parse the file. This would also allow you the change to validate/sanitize the input as necessary. Finally, MongoCollection::batchInsert() would efficiently insert multiple documents into MongoDB at once.

Categories : Mongodb

how to import json file in mongodb?
Your JSON seems to have only a single object. Format like {..},{..} is expected. So, use --jsonArray option: mongoimport -d mydb -c mycollection --jsonArray < glossary.json

Categories : Json

Import and clear a MongoDB database
Well, I suppose I would first switch from using mongoexport/mongoimport to using mongodump/mongorestore. Mongodump is faster, and also will preserve all rich BSON data types, unlike mongoexport. Also, the command db.bar.remove() will go through your collection document by document and drop each one. Since you really want to just get rid of everything, you can do this much more quickly by dropping the entire collection wholesale with db.bar.drop(). This is much faster. However, dropping the collection will also drop any indexes you have built for it, so you will need to recreate those afterwards. It shouldn't be necessary for you to run db.repairDatabase() after each migration, because MongoDB will reclaim the freed space from dropping your collection. What you can do is to use compact (h

Categories : Mongodb

Is there any way to import or convert CouchDB to MongoDB?
MongoDB comes with mongoimport which will import json data. However, this wont convert the date types - A manual import script could be used to convert: "instance_start_time":"1371104307474652" into a datetime - so then you can query against it as a datetime - rather than a string.

Categories : Mongodb

How to import and index mongodb data in solr 4
did you tried the new solr-mongodb connector? http://blog.mongodb.org/post/29127828146/introducing-mongo-connector https://github.com/10gen-labs/mongo-connector

Categories : Mongodb

How to Import Multiple JSON Files to Mongodb?
You will need to write a script in your favourite language that reads each file, JSON-decodes it and then inserts them one by one into MongoDB. In PHP, such a script would be akin to: <?php $f = glob("*.json"); $m = new MongoClient; $c = $m->myDb->myCollection; foreach ( $f as $fileName ) { $contents = json_decode( file_get_contents( $fileName ) ); $c->insert( $contents ); } ?>

Categories : Mongodb

How to efficiently import many large JSON files directly from S3 into MongoDB
You don't need to store intermediate files, you can pipe the output of s3 file to stdout and you can get input to mongoimport from stdin. Your full command would look something like: s3cmd get s3://<yourFilename> - | mongoimport -d <dbName> -c <collectionName> note the - which says send the file to stdout rather than to a filename.

Categories : Mongodb

mongoimport from CSV created only DB not collection
You forgot the --file option This way (no file given) mongoimport is waiting for data feed via stdin. This is why you had to use Clt+c for interrupt. Add --file c:/review.csv to mongoimport command line

Categories : Mongodb

Unable to Import parts with Metadata
Metadata interfaces must not have any properties with setters. You should modify the IPlugInMetadata interface so its properties won't have any setters, otherwise the composition will fail: interface IPlugInMetadata { string Name { get; } } Also, you should consider making your PlugInMetadataAttribute class inherit from ExportAttribute rather than Attribute. That will allow using this attribute as an export attribute and you won't have to use a RegistrationBuilder. EDIT: I think I found your problem When trying to use ImportMany in the constructor, you must specify so explicitly, so your constructor should look like this: [ImportingConstructor] public Engine([ImportMany] IEnumerable<Lazy<IPlugIn, IPlugInMetadata>> plugins) { PlugIns = plugins; } Alternatively,

Categories : C#

python unable to import module
at the top of test.py add import sys sys.path.append("..") base is not a folder on the path...once you change this it should work or put test.py in the same folder as base. or move base to somewhere that is on your path

Categories : Python

Kivy unable to import Camera
I check the above tutorial and it works for me. To make it working i install these packages python-setuptools python-pygame python-opengl python-gst0.10 python-enchant gstreamer0.10-plugins-good python-dev build-essential libgl1-mesa-dev libgles2-mesa-dev cython and then install or update kivy. Once you install kivy than just check it out in python shell Python 2.7.4 (default, Apr 19 2013, 18:28:01) [GCC 4.7.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import kivy [INFO ] Kivy v1.7.1 if it shows the same result than change this line in tutorial code import kivy kivy.require('1.7.1') #change kivy version same as it shows in above import.

Categories : Python

Mongoimport to merge/upsert fields
That's the way mongoimport works. There's an existing new feature request for merge imports, but for now, you'll have to write your own import to provide merge behavior.

Categories : Database

Unable to write to mongodb
i think you forgot the 'new' keyword: var userSchema = new Schema({ // <-- new userName: String, fullName: String, email: String }); var articleSchema = new Schema({ // <-- new name: String, content_date: Date, content: String, author: String });

Categories : Javascript

unable to import evernote.api.client (evernte sdk)
Looks like pip install evernote don't do what it is suppose to do: cat /etc/SuSE-release openSUSE 12.2 (x86_64) VERSION = 12.2 CODENAME = Mantis pip install evernote Downloading/unpacking evernote Downloading evernote-1.24.0.macosx-10.8-x86_64.tar.gz (326kB): 326kB downloaded Running setup.py egg_info for package evernote Traceback (most recent call last): File "", line 16, in IOError: [Errno 2] No such file or directory: '/tmp/pip-build-root/evernote/setup.py' Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 16, in IOError: [Errno 2] No such file or directory: '/tmp/pip-build-root/evernote/setup.py' ---------------------------------------- Command python setup.py egg_info failed with error code 1 in

Categories : Python

unable to import lightblue module python
Check out this question ImportError: No module named Foundation Reinstalling pyobjc seemed to fix it too pip uninstall pyobjc pip instal pyobjc

Categories : Osx

Unable to import NHunspell.dll using ctypes in Python
Thanks @eryksun . But it still did not work. I instead used a Python wrapper for Hunspell called Pyhunspell. The actual link in PyPi does not work for Python 2.7 but it has been improved and upgraded in here.

Categories : Python

Unable to import Modules upon Django deployment
Apache is not addressing to your virtual env. check very first line of your error trace /usr/lib/python2.7/dist-packages/django/core/handlers/base.py Its pointing to default python location not your virtual env. Try this to include virtual env path. sys.path.append('/var/www/projects/openstack-horizon/.venv/local/lib/python2.7/site-packages') Regards Ansh Jain

Categories : Python

Some field's type changes after exporting and importing with mongoimport
You should not be using mongoexport and import if you are moving data between two mongoDB instances. Those tools are intended for exchange of data with external systems. Use mongodump and mongorestore instead - they use bson which is MongoDB's native format and they preserve all types.

Categories : Mongodb

unable to connect to Mongodb using HibernateOGM
You have specified MongoDBDialect in the configuration file. But on the console log, you are getting NoopDialect on HHH000400. And in the next line, you are getting connection was null. And the last line is, Unable to create requested service.

Categories : Java

Unable to query mongodb by date
First, don't forget the Z. That is the ISO8601 indicator for "zulu time", which is another way of saying "UTC" or "GMT". Without it, you are just representing an "unspecified" time, or in other words - a calendar position that is not a distinct moment in time because you didn't indicate how it relates to UTC. (I am not sure if Mongo will allow those or not.) Secondly, it looks like you are trying do an exact equality match. The value in the database has decimals, but the value you're querying does not. So they will never match because they are not the same value. You might instead want to do a range query. For example, you might do this: db.post.find({"dateCreated": {"$gte": new ISODate("2013-08-09T06:29:07Z"), "$lt": new ISODate("2013-08-09T06:29:08

Categories : Mongodb

Unable to query mongolab mongodb
MongoLab creates databases that require an authenticated user to access. When you connect with the Shell, you will need to provide the UserName and Password to the shell command. Docs are here. mongo --username Mark --password something You will need that Username/Password combination to be configured within mongoose as well. The Mongoose docs have details on the possible ways to do this. Note that you are using a very old shell. 1.8.3 is about 4 versions back from the current 2.4.* line. This is not directly related to your problem, but it's definitely something you should rectify going forward.

Categories : Node Js

Mongoimport with data types/ format (long and double) from CSV
mongoimport will always use the default double representation. It can't be used to differentiate between double and long. See Reference > MongoDB Package Components > mongoimport Note Do not use mongoimport and mongoexport for full instance, production backups because they will not reliably capture data type information. Use mongodump and mongorestore as described in Backup Strategies for MongoDB Systems for this kind of functionality.

Categories : Mongodb

unable to import maven project into Intellij Idea :looking for available profile
I had the same Problem. The solution was to edit the /etc/hosts file and add at the first line: 127.0.0.1 localhost localhost See also: Unable to import Maven project into IntelliJ IDEA

Categories : Intellij Idea

Database size on disk increases as a multiple of the CSV file I mongoimport?
MongoDB stores data in a totally different format, called BSON, which is going to take up more disk space. Not only do the values need to be stored for each field, it also will have to store the column names again in each document (row). If you have large column names, this can definitely increase the size in MongoDB to be 8 to 10 times of your CSV file. If possible, you can look at shortening your field names if this is too much for you. MongoDB also preallocates data files for you. For example, the moment it starts adding data to taq.2, it will create taq.3, and similarly when it starts writing into taq.4 it creates tag.5. So in your case, say your 230MB file would create 1.9GB of data, MongoDB has already allocated the 2.0G sized taq.5. This behaviour can be turned off by specifying --

Categories : Mongodb

Unable to update mongodb document with special characters
MongoDB requires all strings to be valid UTF-8. It is quite likely that you are not sending valid UTF-8 into MongoDB, but instead for example have ® as ISO-8859-1 encoded characters. And MongoDB does not allow that.

Categories : Javascript

Unable to connect to Mongodb which is on windows server from ubuntu using php
A few comments: Please use new MongoClient instead of new Mongo. This should not output anything at all. You're just selecting a database and assigning it to a variable. Is that your whole code snippet? What did you expect the output to be? To figure out what is actually happening under the hood with connections you can use MongoLog. With this functionality you can track down what the driver is doing internally. You'd use it like: MongoLog::setLevel(MongoLog::ALL); MongoLog::setModule(MongoLog::RS); MongoLog::setCallback( 'printMsgs' ); function printMsgs($a, $b, $msg) { echo $msg, " "; }

Categories : PHP

Unable to cast object of type error during IIS Deploy -> Import Application
Had the same problem (used Web Deploy 2.0) I changed to Web Deploy 3.5 and it's working now (I uninstalled Web Deploy 2.0 via Control Panel before and used the Web Platform Installer in IIS to install the newer version on server 2012 -simply search for web deploy there)

Categories : Iis

Python Script unable to import installed modules when called as a subprocess
The following works perfectly fine for me, and it's modified because some of your code seemed a little incomplete. inner.py #!/usr/bin/python import os import datetime print os.getcwd() main.py #!/usr/bin/python import os import datetime import subprocess import sys # <---- Some Code---> subprocess.call([sys.executable, "inner.py"])

Categories : Python

"mod_wsgi : Unable to import site module" in Apache Error Logs
In the document you reference, it says the following: http://code.google.com/p/modwsgi/wiki/InstallationIssues#Mixing_32_Bit_And_64_Bit_Packages IOW. y Python installation has not been installed with --enable-shared when configure was run for Python. Also, you do not seem to have removed the existing mod_wsgi properly either if what is installed is still referencing Python 2.4.

Categories : Python

Unable to access data from Mongodb via express/mongoose/angularjs
You likely will want to add a route specifically for the "news": app.get('/news', function(req, res, next){ News. find(). exec(function(err, nws){ if(err) { res.writeHead(500, err.message) } else { res.send(nws); } }); }); Right now, you've got it returning the basics of a web page (res.render('index', { title: 'static Express' });) and then the response from the find call. Angular won't accept that as a result, and it explains why you're seeing the DOCTYPE in the response. And then call it from your Angular code: var News = $resource('/news');

Categories : Node Js

GeoTIFF import in worldwind ::: cannot read raster : unable to decipher image organization
I have found the issue finally: The important thing is to create a CLEAN GeoTIFF file in Matlab (RGB and alpha layer for transparency). Here some Matlab guidance, the resulting GeoTIFF can directly be imported into WorldWind: %%% read intensity values Z (2D matrix) - with values of 0 and above %%% (we want 0 to be completely transparent in the final geotiff) - %%% together with spatialref.GeoRasterReference ss [Z, ss] = geotiffread('./flddph_1976-01-01.tif'); info_3 = geotiffinfo('./flddph_1976-01-01.tif'); %%% generate indexed image with 0 to 255 (255 equals max. intensity) indexedimage = gray2ind(Z); indexedimage = double(indexedimage); %%% normalize so that everything between 0 and 1 normalizedimg = (indexedimage) / 255; %%% scaling data and applying colormap imgscaled = uint8(25

Categories : Java

Symfony2,Doctrine,MongoDb: Unable to pass query result to view
I work with doctrine this way: Controller: $products = $this->getDoctrine()->getRepository("AcmeStoreBundle:Product")->findProducts(); ProductRepository: class GalleryRepository extends EntityRepository { public function findProducts(){ return $this->getEntityManager()->getRepository("TLWEntitiesBundle:Product")->findAll(); } } The rest of the code seems ok.

Categories : Mongodb

Pydev tags import as "unresolved import" but code using this import works fine.
So, what you're seeing here is their distribution model. Usually a module will have one root import that everything stems from, but that's not necessarily the case. They're providing a package with (what I assume) is many modules that don't interact with each other; or they can all stand alone. instead of importing each package individually, you could use the 'from' keyword: from ROOTFOL.PACKAGE import * which will grab everything inside that sub-module. You could e-mail the developer and ask why they deployed it this way...or you could add your own __init__.py to the root folder and, from ROOTFOL import * which will walk the tree. Good luck!

Categories : Python

Querying by example using MongoDb, Express in NodeJS is being escaped incorrectly for some reason. I am unable to search
I found a solution. I wasn't able to convert the objects directly to RegExp as explained in the comments below the quesiton. What I did is create a helper function to return a properly formatted regexp query for mongo, and then perform the .find into it. So, the find will be: exports.findByQuery = function(req, res) { var query = req.query; db.collection('users', function(err, collection) { collection.find( parseRegExpProperties(query) ).toArray(function(err, docs) { res.send(docs); }); }); }; And here's the : parseRegExpProperties method. I don't know how safe is this, but it's at least a start for me : function parseRegExpProperties(obj) { var newObject = {}; for(var propName in obj) { if(typeof(obj[propName]) != "undefin

Categories : Node Js

Python strange import behavior: import x.y works, from x import y doesn't
Works for me: danielallan@MacBook:~$mkdir myproject danielallan@MacBook:~$cd myproject/ danielallan@MacBook:myproject$mkdir lib danielallan@MacBook:myproject$cd lib danielallan@MacBook:lib$touch __init__.py danielallan@MacBook:lib$touch view.py danielallan@MacBook:lib$touch common_lib.py danielallan@MacBook:lib$cd .. In [1]: from lib import view In [2]: view Out[2]: <module 'lib.view' from 'lib/view.pyc'> What happens when you try that on your machine? Are you sitting in the wrong directory, or is your path not configured to find these files?

Categories : Python



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.