A
A
Alexander Sharomet2017-11-15 15:01:25
MongoDB
Alexander Sharomet, 2017-11-15 15:01:25

How to insert html tag into mongodb database?

Hello.
I have a base collection with the following entry:

{
    "_id" : 1,
    "title" : "Title",
    "description" : "<p>Text ...</p>",
}

When displaying the description field, it turns out And I need the tag to work as a tag, and it is displayed along with the text as a string. How can this be fixed? thank.
<p>Text ...</p>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
Urukhayy, 2017-11-15
@sharomet

Databases do not distinguish HTML as a separate kind of data. You need to store it as a string, and on the client form natural HTML from string HTML. How exactly to form - depends on the implementation of the client, its frameworks and libraries.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question