Questions tagged as 'mongodb'

2
answers

How to assign the callback variable "cursor.toArray (err, doc)" to an external variable?

var result = []; var user = db.collection('user'); var cursor = user.find(); cursor.toArray(function (err, doc) { result = doc; }); console.log(result); // console -> []     
asked by 10.12.2017 / 16:31
1
answer

List all states in the JS and Mongo Node

I'm trying to assemble a function to list all states and then print inside an object. Sorry to be so noob, I think it's a pretty silly problem. States function listarTodasOsEstados(){ var estado = [ 'AC', 'AL', 'AP', 'AM', '...
asked by 28.10.2017 / 20:30
1
answer

Problem registering nested objects in Mongodb with mongoose

I have the following collection: // SUSPEITOS - INICIO // const suspeitosSchema = new mongoose.Schema({ nome: { type: String }, sexo: { type: String }, corPele: { type: String }, altura: { type: String }, peso: { type: String },...
asked by 09.11.2017 / 19:40
1
answer

Search for id Mongo

Hello everyone, I'm following the Getting Mean book but I came across a problem I can not solve. I have a document that I show below collecting data from Mongo, and in it I have subdocuments in the case reviews where I want to get the id....
asked by 22.09.2017 / 14:49
1
answer

Doubt about MongoDb relational schema

const SurveySchema = new Schema({ name: String, pages: [ //um survey pode ter várias páginas { type: Schema.Types.ObjectId, ref: 'Page' } ] }); const PageSchema = new Schema({ name: String,...
asked by 25.04.2017 / 18:17
1
answer

Initialize IONIC server.js 1 to run in "production"

SHOULD SERVER.JS BE INITIATED SO I PERFORM IT ON MY MOBILE PHONE? How could I configure it to work this way? This is because I have a service in Mongo, and it needs to be execute the connection with Mongo that is implemented in server.js...
asked by 20.03.2017 / 01:11
2
answers

Sum of number of records per year and month

I need to generate a Json file that will feed a graphic. I need to load the following information. I have a form that receives date (dd / mm / yyyy). My chart shows the number of visits per year x month. I make the following conference in...
asked by 01.09.2015 / 19:43
1
answer

Referencing collections in mongodb

I have a model of an airport in mysql and I plan to upload it to the mongodb via links between collections. In the following images are examples of documents from my collections. (airplane, airport and flight) The id in the flight is...
asked by 27.09.2015 / 17:31
1
answer

Mongodb and Redis on the same server

I am planning a system that uses Mongodb for reading data and Redis for session sharing between PHP and Nodejs. Is it a problem to have both Redis and Mongodb running on the same server, since both store data in memory?     
asked by 04.12.2014 / 00:44
1
answer

Insert Command Line in typescript

I have a MongoDB installation and configuration script as needed by the company. Install_MongoDB.BAT But I would like to automate this process by including in the project in TypeScript. I would like to insert commands that I created in .ba...
asked by 04.12.2018 / 22:15