Questions tagged as 'mongodb'

2
answers

How to increase the id in the mongo?

You can do this, every time I create a new user for example he does the auto increment of _id. Starting from 1 and going up to the number of users     
asked by 09.11.2017 / 11:40
2
answers

Doubt with mongodb test

I'm new to mongo with a query with select / query. I need to do a query that searches the base yoda and the collection configuracoes to return all documents that have the tipoRecibo key with the value equal to gps . I know I ha...
asked by 26.10.2016 / 00:51
1
answer

The 'useMongoClient' error is no longer necessary in mongoose 5.x, please remove it

I tried connecting to the bank using these settings; 'use strict' var mongoose = require('mongoose'); mongoose.Promise = global.Promise; mongoose.connect('mongodb://127.0.0.1:27017/ep', { useMongoClient: true }) .then(() => {...
asked by 16.05.2018 / 13:56
1
answer

Add subdocuments to document - mongoose

Good evening! I have the following document: { "_id" : ObjectId("5b21a4332a5e3333cc64a12f"), "nome" : "João", "sobrenome" : "Barbosa", "cpf" : "12345678910", "senha" : "Fabet@1010", "viagem" : [ {...
asked by 14.06.2018 / 01:41
1
answer

Search for similarity in mongo

I need to do a find on my mongo by similarity example [ { "nome" : "Erick", "codigo" : 1, "periodos" : 10 }, { "nome" : "Erica", "codigo" : 1, "periodos" : 10 }, { "nome" : "Arthur", "codigo" : 2, "periodos"...
asked by 09.11.2017 / 01:04
2
answers

What is the best way to save an image in MongoDB?

I'm developing a JS system with Node server and need to save images in MongoDB in a way that saves as much space as possible, and I'm currently converting the image to Base64 String and saving as an attribute of a document in the collection. B...
asked by 08.10.2017 / 23:50
2
answers

Get surplus positions from an array after comparing with another array?

I have a function (in JavaScript) that compares 2 arrays: let diferencas = []; let numD = 0; for (let a = 0; a < dados.length; a++) { if (dados[a].idEmail === results[a].idEmail) { console.log('Repetido!')...
asked by 06.09.2017 / 21:42
1
answer

Node JS - MongoDB x MySQL

Why every Node JS tutorial we see, is always shown example in MongoDB. What do the two have that are so used? Why not use MySQL with Node?     
asked by 17.11.2016 / 22:29
1
answer

How to insert equal objects or list of objects in MongoDB?

Example, I have the following JSON: { Casa:'b32', integrantes:{ pessoa: 'joao', pessoa: 'Maria', pessoa: 'Daniel' } } When inserting into the database it stays this way. Apparently it is overwrit...
asked by 29.06.2018 / 20:18
1
answer

The updateOne function is not working, it returns OK but does not change anything

I'm using MongoDB to do data persistence in my application, with NodeJS. I make the call like this: module.exports = function (app) { var dbConfig = app.config.db; return { changeAccountStatus: function (request, response,...
asked by 08.02.2018 / 18:48