Posts by Ezequias Dinella • 966 points
21 posts
-
0
votes1
answer140
viewsA: Query return document-specific array’s mongodb
You can use $elemMatch in the projection also: db.getCollection('cursos').find( {turma: {$elemMatch: {'aluno.usuarioId': ObjectId("58a723964530540a70e2b37b")}}}, {turma: {$elemMatch:…
mongodbanswered Ezequias Dinella 966 -
0
votes1
answer40
viewsA: Mongodb finds no record of some names
There are several characters that are used as a hyphen, it may not match what is in the document. See here some different characters that can sometimes get confused:…
-
1
votes3
answers82
viewsA: Add numbers respecting formatting R $ 00,00
I included one more instruction: total = total.toFixed(2); See more rises toFixed here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed See how it…
-
1
votes1
answer94
viewsA: $lookup no db.createView()
Each stage of the aggregation receives the result of the previous one. So just use it dot-Notation to access the desired field. Try something like for example: [ { $lookup: { from: "companies",…
-
3
votes2
answers351
viewsA: Doubt with mongodb test
You can use the method find() to run a query that fetches documents from a Mongodb collection. All queries in Mongodb have as their scope a single collection. Queries can return all documents from a…
-
0
votes4
answers2211
viewsA: JSON Object Object Object
The JSON is the representation String of the Javascript object. It’s easier to manipulate it as an object. You can access an object property in several ways: objeto.chave or objeto['chave'] now we…
-
4
votes5
answers711
viewsA: Change Divs with the same class
Some ways to do: 1 - Using Jquery (working example) $('.valor').append('%'); 2 - Using CSS only (working example) .valor:after { content: "%"; } This technique uses the pseudo-element ::after of…
-
2
votes3
answers1100
viewsA: Change the iframe (embed bootstrap) according to the navigation bar button
You can also use the same frame, changing its destination. The frame needs to have a name to be referenced. In this example I put name="meuframe" <iframe name="meuframe"…
-
0
votes1
answer1227
viewsA: How to overlay CSS styles without interfering with another previous CSS?
You can add or remove only one class in the body, then include it in the dark style selectors: $(".bt-tema").on("click", function(e) { $('body').toggleClass("escuro"); }); Putting the dark…
-
0
votes1
answer286
viewsA: How to make a findOneAndUpdate in an array within another array with Mongoose
Try this way: SeuModel.findOneAndUpdate( {'pessoa.endereco.id': '573c5ed236c156cc2351d1ef'}, {'$set': { 'pessoa.$.endereco.$.cidade': 'Nova cidade', 'pessoa.$.endereco.$.bairro': 'Novo bairro' }},…
-
1
votes1
answer1163
viewsA: Mongoose - Single object in an array
The index unique avoids duplicity of documents in the collection, not items in the array. Use the operator $addToSet to add a value to an Array only if the value is not present. var where = {_id:…
-
0
votes1
answer160
viewsA: How to save php session in Mongodb and recover data in Nodejs
Instead of session, you can use the default JWT of tokens, you will already find ready material in several languages. For example, in the login you can generate the token, and check it on another…
-
15
votes4
answers16863
viewsA: Cross-browser way of copying text to the Clipboard (Clipboard)
Try the Clipboard.js. You don’t use Flash. It has no dependencies. Only 2kb. Super easy to use.
-
1
votes1
answer177
viewsA: Broadcast via an Express route
Without a doubt, yes is possible. See an example: On the server, app.js var _ = require('lodash'); var app = require('express').createServer(); var io = require('socket.io')(app); app.listen(80);…
-
20
votes15
answers4487
viewsA: Determine if all digits are equal
With regular expressions Using regular expressions is easy to implement this idea in any language: ^(\d)\1*$ Explaining ^ mark the beginning of the string (\d) I get a numeric digit \1 the following…
-
3
votes2
answers649
viewsA: When should I maintain or delete a branch?
In Git, branches are just pointers (references) to commits in a directed acyclic graph (DAG) of commits. This means deleting a branch only removes commit references, which can make some commits in…
-
1
votes2
answers250
viewsA: Sum number of records per year and month
Pre-aggregation If you already know the way you want to query the data, here is a use case that should solve: http://docs.mongodb.org/ecosystem/use-cases/pre-aggregated-reports/ However, if you want…
-
0
votes4
answers8659
viewsA: Receive real-time input value
You no longer need to be observing events, let Angular.js take care of it. To deal with the dates, use Moment.js; you can do without, but to lose your hair so young, is not even? See an example…
-
1
votes1
answer1017
viewsA: PHP variable with select(combobox) text
You can keep the association in an array, use it to power the select, and also to get its value after. <select name="uf"> <?php $estados = array( "SP" => "São Paulo", "RJ" => "Rio de…
-
4
votes1
answer561
viewsA: Digital Signage System with Nodejs, is it possible?
You sure can do it. Take a look at these sample apps to be inspired. You can communicate using REST, Websockets, Zeromq, Torrent, etc. The design of this architecture will depend more on the rules…
-
10
votes2
answers3515
viewsA: Remove more than one item from an array
The first argument of splice is an index in the array, the second is the amount of items to remove from there. So stay like this: var itens = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; var indice = 2; //…