Questions tagged as 'mongodb'

1
answer

Pass variable in query MongoDB (JAVASCRIPT)

With this query: const result = await Topic.find( { 'categorieName': { $regex: /^news/i } } ) I can return the categories with news name, the problem is that it is not always news, so I wanted to put a variable in place How do I do this?...
asked by 03.01.2019 / 20:12
1
answer

Update an index value of an array of a MongoDB document

Well, I'd like to know how to update a value of a document that is inside an array. See the document: > db.alunos.find().pretty() { "_id" : ObjectId("5ba141b186b9fc17121423a1"), "nome" : "Diego", "cursos" : [...
asked by 18.09.2018 / 20:27
2
answers

Error passing arguments in JSON

I'm trying to make an insertion in MongoDB by passing some arguments in JSON: { "name": "TESTE", "category": "B", "service": "Novo processo", "description": "Novo Teste", "active": false, "classmodels": [ {"...
asked by 19.10.2018 / 20:42
1
answer

How to return an object from a database in SQL (MongoDb)?

I currently have some objects in a MongoDB database. The structure is as follows. { "_id" : ObjectId("55cb9c666c522cafdb053a68"), "geometry" : { "type" : "Polygon", "coordinates" : [ [ [...
asked by 28.06.2018 / 20:05
1
answer

How do I create a field that references a sub-array of a collection in mongoose?

Imagining the following structure (illustrative example only): Collection: Schools [ { "_id":"abc123", "nomeEscola":"escola1", "turmas":{ "_id":"ccc333", "nomeTurma":"Turma1" } }, {...
asked by 13.09.2018 / 14:18
1
answer

Crud with MongoDB and C # error in type or namespace

Following a tutorial from Macoratti here , errors appear in three types. I do not know what to add to solve it. I did a Copy and Paste and gave an error. Below the code: using MongoDB.Driver; using System; using System.Configuration; namespa...
asked by 08.06.2018 / 20:44
1
answer

Help with MongoDB

I'm having a problem using .find() of mongoDB with RegExp. I have the following command: db.collection.find({"city": /SAOPAULO/}) When I do: db.collection.find({"city": /SAO/}) It searches in time, but when I pass a large word i...
asked by 23.04.2018 / 20:04
1
answer

How to connect to the MongoDB Compass Community?

I installed mongodb on my machine and along with it came the Compass Community program. When I run mongod.exe you can see the hostname and port, so I put the hostname in the Hostname field and put it in the Port field in the Compass Community...
asked by 16.05.2018 / 13:02
1
answer

Post by postman is giving Object reference error not set to an instance of an object

I notice that FromBody is coming null and I do not know why. This is my payload on Postman { "ChannelCode" : "TS", "Name" : "Teste", "Celphone" : "(11)999999999", "Endpoint" : "www.teste.com.br", "TokenLogin" : "123456...
asked by 14.06.2018 / 16:15
1
answer

How to relate two models with mongoose?

I have two models in my bd user.js var mongoose = require('mongoose'); var Schema = mongoose.Schema; var bcrypt = require('bcrypt'); // User Model var UserSchema = new Schema({ name: { type: String, unique: tru...
asked by 29.01.2018 / 19:14