Check if post exist if not create a new post

I want to validate to check if a post exist in the database if it doesn't create it. Var post is a json date that we getting from an api, and every time we run this route we hit the api which adding the same data multiple times. I want to validate...
more »

2017-08-15 22:08 (0) Answers

react-native unable to resolve module 'events'

I have created an empty project with the following command: react-native init demoProject after installing npm install -g react-native-cli then I have installed mongoDB with the following command: npm install mongodb --save In the package...
more »

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

Reading MongoDB documents into Haskell data types

My ultimate goal is to return a JSON response from a scotty endpoint that runs a MongoDB query. So far I've got the query written down, but it returns a Document and I want to turn that Document into a custom type that I've defined. Here is the code...
more »

2017-08-12 22:08 (0) Answers

Mongoose validate Schema with no Model

I want to validate some inner elements of an object against schemas that are members of a larger schema before posting that object on the model correspondent to that larger schema. Someone already asked this question and this answer has something si...
more »

2017-08-12 09:08 (0) Answers

Mongo /data/db should be writable?

I'm starting with MongoDB and it looks like it needs a writable /data/db. So I created a folder /data/db as superuser but then when I start it requires the rights the write on that directory (makes sense). My question is : should I do a chmod 777 on...
more »

2017-08-11 17:08 (0) Answers

node.js | Redis cache loading old data

I am trying to setup a mongo, node and redis server and all is working well other than the Redis cache which seemingly loads the older data. Taking Redis out and using pure Mongo returns the right data, and if I click submit again it will load the d...
more »

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

Sort Mongoose data

I'm working on sorting my mongoose data. Currently what I am doing below is working perfectly: Rentals.find({}).sort({featured: -1}) I am now trying to add a way to not show the rentals that are "reserved." I've been trying this but it is not ...
more »

2017-08-07 18:08 (1) Answers

Can't install PHP extension mongo with Composer

How to install PHP extension Mongo with composer in mac machine? I use following command to install PHP extension with composer. composer install --prefer-source I got the following exceptions. vagrant@vagrant:/var/www$ composer install --prefer-...
more »

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

mongo sort subdocument for group

I have a members collection: { "_id": ObjectId("597cace8e68903af813c4fe8"), "lastName": "Smith", "firstName": "Lloyd", "captain": ObjectId("597cace8e68903af813c4fe8") } { "_id": ObjectId("597cace8e68903af813c4fec"), "lastNam...
more »

2017-07-31 20:07 (1) Answers

Not Match Regex for Email

Not sure I'm doing this right. var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; db.test.find({ "Email" : { $regex : re}})....
more »

2017-07-26 02:07 (1) Answers

Wrapping a Class' subclass method

My main class is defined as follows: from pymongo import MongoClient from credentials import MongoMarketPlaceAuth client = MongoClient('mongodb://conn_url:conn_port/', ssl=True) db_connection = client.DB_NAME db_connection.authenticate(name=MongoM...
more »

2017-07-24 20:07 (1) Answers

MongoDB-mongoose does not respond to REST API

I have a strange issue with MongoDB-mongoose, which does not respond to REST API mongoose version - 4.11.3 Mongo DB shell version 3.4.6 Everything is local on my computer Connection to Mongo DB is the following: server.js var mongoose = require('m...
more »

2017-07-23 22:07 (1) Answers

created user in mongo with read role can insert

I've created a user in mongo for this database with read access only, but when I login in robomongo I can insert and even create new collections in test2 database is there anything wrong? use test2 db.createUser( { user: "user", pwd: "...
more »

2017-07-22 14:07 (1) Answers

Declaration of MongodbSource Error

I'm using mongoDB version 3.4.4 with cakephp 3.0 I've installed chikaway/cakephp-mongodb plugin from https://github.com/ichikaway/cakephp-mongodb I'm getting this warning: Strict (2048): Declaration of MongodbSource::value() should be compatib...
more »

2017-07-20 11:07 (0) Answers

REST API for turn based game?

We're working on a turn based multiplayer game, for which we need to implement some backend functionality which will keep track of players data and games. My first approach has been to design a REST API using NodeJS and MongoDB that will let the cli...
more »

2017-06-28 16:06 (3) Answers

Meteor Simple Schema validating object

I have defined a schema for a meteor mongo collection using smpl-schema and I'm getting some confusing behavior. I'm trying to define an Array of Objects which validates fine, but on insert fails. import SimpleSchema from 'simpl-schema'; const Sche...
more »

2017-06-24 18:06 (1) Answers

$match Array in a raw MongoDB Laravel Query

I'm working with mongodb in laravel using jenssegers driver and i have 3 documents likes this in my db { "_id" : ObjectId("594dd540bb7de924c0005583"), "cliente" : "Luis", "tipo" : "Luis", "paquete" : "Luis", "fecha" : null, "fechaE" : null, "...
more »

2017-06-24 05:06 (1) Answers