How to filter by numbers with Node-RED REST-API

I created a small REST-API for my MongoDB with Node-RED. This works fine: <node-red-url>:<node-red-port>/rest/demo shows me all entries. I can even filter the result: Appending ?userName=demo shows only entries where {userName: "demo"}....
more »

2017-03-16 16:03 (1) Answers

How can I use "not like" on laravel mongodb?

I see here : https://github.com/jenssegers/laravel-mongodb I try : $user = Comment::where('body', 'like', '%spam%')->get(); It works But when I try : $user = Comment::where('body', 'not like', '%spam%')->get(); It does not work Seems ...
more »

2017-03-15 16:03 (1) Answers

Sort Data In Node.JS

I am using Node.JS and MongoDB. I've created a report with CSV file and this is my code, function buildListCsvContent() { var array = []; var counter = 0; for (var i = 0; i < vm.student.length; i++) { var row = { No: coun...
more »

2017-03-14 16:03 (2) Answers

How does Top-K sort algorithm work in MongoDB

Based on the answer and from MongoDB Documentation, I understood that MongoDB is able to sort a large data set and provide sorted results when limit() is used. However, when the same data set is queried using sort() results into a memory exception. ...
more »

2017-03-13 16:03 (1) Answers

Issue to send the right data to the Blade View

When i dd() the variable after applying a filter, i get the right number of arrays. But when i pass this array to the laravel blade view i get all the records. Heres the code. $user = Auth::User(); $boards = Board::all(); $s = 'Tom Cruise'; $finala...
more »

2017-03-10 21:03 (1) Answers

Bcrypt Not Saving Password?

For some reason when I try to hash and save a password the new password is not saved to the database? I'm using MongoDB, NodeJS, and passport to let the users change their password. UserSchema.pre('save', function(next) { var user = this; var S...
more »

2017-03-09 18:03 (1) Answers

Error with Nodemailer in expressjs?

I'm using Nodemailer to set up forgot password functionality. For some reason my code gets hung up in the smtpTrans.sendMail part. Am I correctly setting up Nodemailer? UPDATE: Take a look at the full code below including the async.waterfall code...
more »

2017-03-08 15:03 (1) Answers

MongoDB + NodeJS: MapReduce or manual calculation

I am creating a REST API in NodeJS that connects to MongoDB does a MapReduce and store the results on a different collection. The code is pretty simple. It takes a User ID, gets all other users who are related to this user somehow using some algorit...
more »

2017-03-06 19:03 (1) Answers

Java to Mongo Document date

I am inserting a document by converting the pojo to document object using static parse method from Mongo driver. Document newList = parse(gson.toJson(myPoJo)); collections.insertOne(newList); This pojo has a Date attribute. But parse method will ...
more »

2017-02-28 12:02 (2) Answers

MongoDB Date Type: Casting fails

var MySchema = new Schema({ ... expireAt: { type: Date, default: Date.now }, ... }); If I use this Schema everything works but If I set a more complex default like this: var MySchema = new Schema({ ... expireAt: { type: Date, d...
more »

2017-02-24 12:02 (1) Answers

Angular - Mongoose : Can't manipulate dates

I have been searching for a long while for solution, but nothing helped me. I have an Angular JS app which runs with Mongoose and Express. I want to store date as object from a simple form. But when I submit my form, dates are stored as String and...
more »

2017-02-19 15:02 (1) Answers

Performing dynamic request validation

I have an object from mongodb like this { "_id": "588c5c0d709d11e2aa0da250", "fields": [ { "type": "text", "required": true, "placeholder": "Food name", "name": "name", "label": "Name", "order": 1 }, ...
more »

2017-02-18 11:02 (1) Answers