I wanted to delete certain set of documents in the mongo collection and insert new records, in case if the insert fails I want to rollback the delete. Basically, it is either both or none. Someone know what is the best approach for this. I'm using mo
** It turns out that the problem was at the server ** I'm trying to excute HTTP post request (from my angular client) to my server (node express). The server recive the request but the data is undefined. Already tried to make this req by postman and
I'm creating a new schema in mongoose and trying to take input from user. I want that no duplicate entry is getting updated for serverIP, for that unique : true is added. But this is not working as expected and duplicates entries are getting through.
I'm calling a stored procedure using seriate to register users and the output JSON like this when the user is created and the first value {"":208} is the generated userId {"sets":{"sp_CreateNewUser":[[[{"":208}],[{&
This question already has an answer here: How do I return the response from an asynchronous call? 31 answers Lately I have started experimenting with Node.js and Express.js. I am building a micro-application which takes in the data from Mongo Db and
For the following schema (pseudo code). var Post = { title: "", content: "", date: new Date() } I want to return results grouped by month & year, so something like so, again psuedo code: [ { year: "2016", month: "4&q
I have one JSON data which I have written in my JS code as let CreateIssueFormData = (function() { return { "fields": { "project": { "key": "NC" }, "issuetype": { "id": "" }, "comp
From my NodeJS program I connect to Mongodb with native driver. I start mongod and see server waiting for connections. When my program connects I can see however 5 connections instead of one. I don't understand why is happening as I do nothing unusua
All of the examples I see are pushing notifications from the server to the client. How do I contact the server from the client and how would the path look? Normal http requests can be matched using app.get('path',callback). Is this same matcher used
I'm very new to AngularJS. I am trying to automate an angularJS app. installed node.js installed protractor (npm install -g protractor) updated webdriver manager tool (webdriver-manager update) started the driver (webdriver-manager start) I create a
I need to do a repetitive auth process in most routes in my app. I decided to give some structure to it and get that repetitive work in a middleware function. If the auth process isn't valid, I should response and avoid second function to execute, te
I understand that Node.js is asynchronous and I understand what this means from a developer's point of view. I get the whole restaurant examples and non-programming perspectives. What I don't get is how JavaScript, which is (largely?) synchronous, wa
I am using node-webkit and ADBkit to attempt to read a line from an android build.prop and do something depending on what that line is. full script at http://pastebin.com/7N7t1akk The gist of it is this: var model = client.shell(devices, "su -c 'grep
I am making a small app in sails.js and I need to store images in database. For that, I need to convert an image to a base64-encoded data URL so that I can save it as a string in my sails models. However, I don't know how to convert it in this form.
This seems really poorly documented.. The documentation example just has callback being passed to update. There is a link redirecting to Model.update here and the example shows the parameters of the callback are (err, numberAffected, raw). Does the D
I've been reading a lot on Nodejs and its frameworks and recently finished my first full javascript frontend (using Angularjs). I've decided that my next pet project will be a Nodejs adventure using one of these two frameworks: Sails.js Meteor I've r
With .post of FORM data to express/node.js All of the values are currently stored and returned as STRings Am looking to have one of the data values (req.body.quantity) stored as an INT //POST app.post('/add', function (req, res) { db.collection('demo
I have an array of versions: var versions = ['xs', 'sm', 'md', 'lg', 'thumbnail']; I want to get all the image stored in this array that do not contain any of these suffixes. Here is an example of the array of images: { "files": [ "/public/
How to change it from 5858 to 7000, for example?You can use --debug option: node --debug=7000 app.js
In the below code I can't figure out why req.pipe(res) doesn't work, and yet doesn't throw an error either. A hunch tells me it's due to nodejs' asynch behavior, but this is a very simple case without a callback. What am I missing? http.createServer(
I'm trying to get a node.js app to interact with a .NET SDK fingerprint reader called U.are.U. The SDK provides .dll (win32 and x64), Java and .NET libraries. I decided to use .NET for the simple of use, having all the interfaces ready to use and all
I know node.js can build web apps that run super fast, but I just can't find enough info about how it would perform in a magazine or news style website. I know some CMS's like Joomla or Drupal (or even wordpress) are very good at it, but as the numbe
i started using railway (a node.js mvc framework) and i want to use sass/less/stylus as a css render engin. i couldn't find how to configure that in railway. railway uses express.js so i guess i can install it via that. i already installed stylus (an
I have this html: <form action="/Home/Insert" method="POST" name="form1"> Name: <input type="text" name="Name"/> <br/> Price: <input type="text" name="Price"/> &
I deployed a nodejs server in Rackspace and can be accessed internally, like using: curl http://127.0.0.1:8080 However, it can't be accessed from the outside (the internet) even if I do this: iptables -A OUTPUT -p tcp --dport 8080 -j ACCEPT iptables
I am trying to pull or clone a git repo from my joyent smartmachine no.de thru putty. I can connect to my sever easily, but as soon as I write: git pull
[email protected]/accoutName/repo , I get the following error: Permission denied (publickey). fatal:
I would like to log details regarding server requests into a file each time they occur. What would be the optimal way to do this? Currently using: fs.open("./log_"+log_date.getMonth()+"-"+log_date.getDate(), "a+", function(er
My CouchDB databases are inside of this directory: http://example.com/couchdb/ For example, I have a CouchDB database "foo" here: http://example.com/couchdb/foo/ What should I list as the "host" in the cradle setup function? cradle.set
What is the purpose of Node.js module.exports and how do you use it? I can't seem to find any information on this, but it appears to be a rather important part of Node.js as I often see it in source code. According to the Node.js documentation: modul
Does anyone know what the memory and threading models are in nodejs? In particular, is ii++ atomic? Does it behave as if ii were volatile in Java 1.5, in Java 1.4, in C, or not at all?It is useful to understand how node and V8 interact. Node handles