Search by date in MongoDB

2

I have a collection called users and within this I have an arrangement of objects called news and I need to make queries by date and you

_id:1
nombre: "Jorge Hernandez"
nuck: "ADES"
twitter:"[email protected]"
descripcion:"nice"
nivel: 57
ciudad: "palmira"
telefono: Object
  fijo: "3128239"
  movil: "312748570"
noticias: Array
  0:Object
  titulo: "El principito"
  cuerpo: "imformacion importante aqui"
  fecha: 2018-08-16 19:00:00.000
  tags: Array
    0 : Object
    a : "aaa"
    b : "bbb"
    c : "ccc"
  comentarios : Array
    0 : Object
    comentario : "es muy malo"
    momento : "ahora"
    
asked by Jeissøn MyThoLoGy 18.08.2018 в 01:43
source

1 answer

0

You must be accessing element by element until you reach the date and then use the function ISODate()

{db.usuario.noticias.fecha:ISODate("2018-08-16 19:00:00.000")}

I hope it serves you ... XD

    
answered by 18.08.2018 / 01:50
source