MongoDB $in and “like” – getting records that have zip codes LIKE what is in a n array

I have a collection of addresses, with postal codes. I want to get all the records by using an array of postal codes so this query works fine db.getCollection(‘addresses’).find({“address.postal_code”:{$in:[‘40475′,’37214’]}}) This is great if all my postal codes are exactly 5 digits… But some people enter the plus 4 – so I might have an address…

Spring Data – MongoDB – Aggregation how to project all fields of grouped reference document

I have 2 documents, Topic and comment. Each topic has many comments and the documents look like this: @Document public class Topic { @Id private String id; @Indexed(unique = true) @NotBlank private String title; } @Document public class Comment { @NotBlank private String text; @Indexed @NotBlank private String topic; // id of topic @CreatedDate @Indexed…

Can’t decode URI data previously sanitized with express-validator “sanitizeBody” when retrieving from MongoDB?

A Message object is stored in mongoDB after being sanitized and escaped with express-validator “sanitizeBody”. When retrieving that Message object from MongoDB, I’m failing to decode any characters that were URI encoded with sanitizeBody. In the below example, “message.message” retrieves the message that’s stored in the message object. I’m currently trying decodeURICompontent(). exports.index = function…

Can not connect MongoDB docker-compose

Can not connect mongodb run in docker-compose MONGO_URL=mongodb://db:27017/500ae_cms error: MongoDB connection error: mongodb://db:27017/500ae_cms. MongoNetworkError: failed to connect to server [db:27017] on first connect [Error: getaddrinfo ENOTFOUND db at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) { name: ‘MongoNetworkError’, errorLabels: [Array], }] docker-compose file