skip to Main Content

Mongodb – How to remove double quotes inside double quotes in string field?

Currently a document looks like this: { "Post": "this is a post", "_id": ObjectId("630f3c32c1a580642a9ff4a0"), "iframe": ""https:/www.youtube.com/embed/RzVvThhjAKw"", "slug": "this-is-a-title", "title": "This is a title" } But I want it like this: { "Post": "this is a post", "_id": ObjectId("630f3c32c1a580642a9ff4a0"), "iframe": "https:/www.youtube.com/embed/RzVvThhjAKw",…

VIEW QUESTION

How to filter mongodb collection using date field?

I have date string like this '2021-03-09' And my mongodb collection like this { "_id": { "$oid": "633aede250625c10dddfd57b" }, "title": "test 1", "description": "Hello World", "date": { "$date": "2021-03-09T18:30:00.000Z" }, "image": "fd16b297-9ad1-4e84-8c3e-715a33b351b3.png", "createdAt": { "$date": "2022-10-03T14:12:50.399Z" }, "updatedAt": { "$date":…

VIEW QUESTION

How to initiate mongodb replica set using nodejs

I'm running the following code for mongodb replica set initialization: try { const mongoClient: MongoClient = new MongoClient(process.env.MONGODB_URI || 'mongodb://mongodb:27017', {replicaSet: "rs0"}); const mongoDb: Db = new Db(mongoClient, "admin"); const response = await mongoDb.admin().command({ replSetInitiate: {} }, {}) } catch…

VIEW QUESTION
Back To Top
Search