Questions tagged as 'mongodb'

1
answer

Connecting Go with MongoDB using Docker

I'm creating a microservice in Go, using MongoDB as the database and using the mgo library. Using MongoDB in a docker container locally and running the application on my machine, everything works normally, but when I tried to run using...
asked by 13.12.2017 / 21:42
1
answer

I can not return another field other than the primary key using $ project

I'm starting in MongoDB and would like to do a query on my bank like: Which animals got sick in the year 2016? Using $ group and $ project: db.animais.aggregate([ {$unwind : "$doencas" }, {$project : { year : {$year : "$doencas.data_di...
asked by 10.12.2016 / 17:09
1
answer

I can not insert into MongoDB using Java

I'm new to mongo, I'm trying to make an insert in the bank but it's the problem at the time of inserting import com.mongodb.BasicDBObject; import com.mongodb.DB; import com.mongodb.DBCollection; import com.mongodb.MongoClient; public clas...
asked by 20.09.2016 / 04:30
3
answers

Search MongoDB Array

I have these two documents in the mongo: /* 0 */ { "_id" : ObjectId("54f395ef7a5a5ea37af77398"), "HISTORICO" : [], "MOTIVO" : "", "RP_CANCELAMENTO" : "", "DATA_CANCELAMENTO" : null, "RP_FINALIZACAO" : "", "DATA_FINALIZACAO" : null, "STATUS_CH...
asked by 02.03.2015 / 00:53
2
answers

Why can not I open the MongoDb interface on the port: 28017?

I installed mongo on drive C and did some data creation tests and persisted, then I checked and there they were listed perfectly at the prompt. Until then, everything is OK! I open the browser and type localhost: 27017 and the sign of life messa...
asked by 22.01.2016 / 17:13
1
answer

Java + Database - Add Role to existing user, through Java

Use MongoDB with Java and need, through Java execute the following command in mongoDB: db.grantRolesToUser( "joao", [ {role:"dbOwner",db:"loja"} ] ) That is, I need to add a role to an existing user, and I need to specify the database. Afte...
asked by 06.01.2016 / 16:24
1
answer

Is it possible to create a remote server with MongoDB? In what way?

My question, to be clearer, is to create a server with mongodb in a cloud hosting (for example) and access it through another server. Example: I have a mobile app. I hosted my mongoDB in a cloud hosting (ubuntu). I want to connect my app to d...
asked by 24.04.2014 / 13:29
1
answer

Correct way to make one-to-many relationship using C # and MongoDB

I have two entities, Sistema and Comentario where a system can have several comments: public class Sistema { public ObjectId Id { get; set; } [BsonElement("SistemaId")] public int SistemaId { get; s...
asked by 05.07.2016 / 14:40
1
answer

How do I get the exception Mongoid :: Errors :: DocumentNotFound released on Mongoid

To try to do a test similar to this below capture the exception of a nonexistent document expect(Produto.find('57e2bf76ce222fd11258cd4e')).to raise_error(Mongoid::Errors::DocumentNotFound) The exception message being passed is shown, howeve...
asked by 21.09.2016 / 19:34
1
answer

Change field unique collection mongodb

Good morning, I have a collection in mongodb with a unique:true field. I would like to change this field to false. If I change the code and delete the entire collection it works, but if I make the change in the code and do not dele...
asked by 27.02.2015 / 12:38