how to push data into mongodb using sparkfun phant? - node.js

I am new to phant and i cannot find a suitable documentation on phant using mongodb. because i have lots of data and it memory overflow occurs. and finally i fell into following error:
HTTP output: { [Error: EMFILE, open 'phant_streams/4d16/83403f7611e5810d57f88174fbef/stream.csv']
errno: -24,
code: 'EMFILE',
path: 'phant_streams/4d16/83403f7611e5810d57f88174fbef/stream.csv' }
events.js:87
throw Error('Uncaught, unspecified "error" event.');
^
Error: Uncaught, unspecified "error" event.
at Error (native)
at Function.emit (events.js:87:13)
at Function.<anonymous> (/usr/lib/node_modules/phant/node_modules/phant-manager-http/index.js:237:12)
at PhantMeta.<anonymous> (/usr/lib/node_modules/phant/node_modules/phant-meta-nedb/lib/phant-meta-nedb.js:243:14)
at callback (/usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/executor.js:30:17)
at /usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/datastore.js:536:25
at /usr/lib/node_modules/phant/node_modules/phant-meta-nedb/node_modules/nedb/lib/persistence.js:201:12
at fs.js:1077:21
at FSReqWrap.oncomplete (fs.js:95:15)
except this sometimes following error also occurs:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
thats why i want to use mongodb to prevent this error. i searched about this and finally found sparckfun library for mongodb:
https://github.com/sparkfun/phant-stream-mongodb
i installed this but nothing happened as data still not string into mongo.
so, How will i store phant data into mongodb ?

I had the same problem, specifically trying to deploy my own Phant instance on Heroku (since I wanted to circumvent Sparkfun's 50Mb limit). After some dabbling with versions of the mongodb and mongoose libraries, I successfully forked and modified their repository so that you can either run it locally or directly deploy on heroku (just make sure you provision a MongoLab add-on). Check out my fork here: https://github.com/davidlago/phant
Hope this helps!

Related

Error: write EPIPE trying to setup shopify app

I tried to install a shopify app in my development store. I used both the manual way (https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/embed-your-app-in-shopify) as the CLI way (https://shopify.github.io/shopify-app-cli/getting-started/).
I keep getting this Error: write EPIPE at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:94:16)
I don't know what I'm doing wrong and why I can't find any solution on that error. Am I really the only one facing this problem?

Error: The hook `orm` is taking too long to load

whenever trying to lifting sails it gives me the hookTimeout error every time.
While for the same configuration settings it's perfectly running on other systems.
using Ubuntu 16.0.4 and Manjaro
nodejs version 7.4.0
sails version 0.12.11
Mongodb version 3.4.1
the complete error report is like this.
info: Starting app...
error: Grunt :: /usr/local/lib/ruby/gems/2.4.0/gems/sass-3.4.23/lib/sass/util.rb:1109: warning: constant ::Fixnum is deprecated
error: Grunt :: /usr/local/lib/ruby/gems/2.4.0/gems/sass-3.4.23/lib/sass/util.rb:1109: warning: constant ::Fixnum is deprecated
error: Error: The hook orm is taking too long to load.
Make sure it is triggering its initialize() callback, or else set `sails.config.orm._hookTimeout to a higher value (currently 60000)
at Timeout.tooLong [as _onTimeout] (/home/navalk/PV/provakil/sails/node_modules/sails/lib/app/private/loadHooks.js:92:21)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
Try do cut your last created/changed model.
If won't help, try to cut one by one and move to another folder.
You will then find if it is issue with some of your models or really with sails.
Try increasing hook timeout in local.js
hookTimeout : 30000,

SQLITE_IOEERR: in Meteor

Retrying after error { [Error: SQLITE_IOERR: disk I/O error] errno: 10, code:
'SQLITE_IOERR' }
Retrying after error { [Error: SQLITE_IOERR: disk I/O error] errno: 10, code:
'SQLITE_IOERR' }
/home/kdibbs/.meteor/packages/meteor-tool/.1.4.2.1r0536n++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:190
throw error;
^
Error: SQLITE_IOERR: disk I/O error
at Error (native)
=> awaited here:
at Promise.await (/home/kdibbs/.meteor/packages/meteor-tool/.1.4.2.1r0536n++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:39:12)
at Db._execute (/tools/packaging/catalog/catalog-remote.js:355:8)
at /tools/packaging/catalog/catalog-remote.js:144:10
at Db._retry (/tools/packaging/catalog/catalog-remote.js:156:16)
at new Db (/tools/packaging/catalog/catalog-remote.js:143:8)
at RemoteCatalog.initialize (/tools/packaging/catalog/catalog-remote.js:694:15)
at /tools/cli/main.js:815:20
So I ran this meteor program a few days ago, then I made a few more users and a group on my machine..All of which didn't affect my normal user...And now I'm getting this error? Any clues?
Thanks.
Did you try searching for this? Looking at the SQLite reference here https://www.sqlite.org/rescode.html#ioerr
It sounds like one of your disks is giving an error - something like too many files open, or perhaps it's getting full?
(10) SQLITE_IOERR
The SQLITE_IOERR result code says that the operation could not finish
because the operating system reported an I/O error. A full disk drive
will normally give an SQLITE_FULL error rather than an SQLITE_IOERR
error.
There are many different extended result codes for I/O errors that
identify the specific I/O operation that failed.

Where is child_process.js?

I am trying to debug a problem with forever/nodejs, and I get this stacktrace in the error log:
chdir(): Permission denied
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn EACCES
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
This looks to me like I should be able to look at line 980 of a file named "child_process.js" to see where the error is thrown. However, I cannot locate such a file on the system even with "find". Am I missing it somehow, or is the stracktrace lying?
It's part of the node.js source. See https://github.com/joyent/node/blob/master/lib/child_process.js. I believe you can also step directly through core node code using node's built-in debugger, or a package such as node-inspector.

Node.js redis "unknown command 'hset'"?

I'm new to redis, and I'm trying out various examples. However, it doesn't seem to work:
root#localhost:~# node lol.js
Reply: OK
Error: Error: Error: ERR unknown command 'hset'
Error: Error: Error: ERR unknown command 'hset'
/root/node_modules/redis/index.js:468
throw callback_err;
^
TypeError: Cannot read property 'length' of undefined
at Command.callback (/root/lol.js:15:28)
at RedisClient.return_error (/root/node_modules/redis/index.js:464:25)
at HiredisReplyParser.<anonymous> (/root/node_modules/redis/index.js:253:14)
at HiredisReplyParser.emit (events.js:67:17)
at HiredisReplyParser.execute (/root/node_modules/redis/lib/parser/hiredis.js:41:18)
at RedisClient.on_data (/root/node_modules/redis/index.js:440:27)
at Socket.<anonymous> (/root/node_modules/redis/index.js:70:14)
at Socket.emit (events.js:67:17)
at TCP.onread (net.js:367:14)
I'm using one of the example scripts on the github page for node-redis. I'm on Debian Squeeze.
The main problem is not with your code (of course it could recognize the error sent by the server) or with the node redis module but with the Redis server.
You need to upgrade it to a newer version, HSET command is supported since version 2.0.0.

Resources