<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: wasim15185</title>
    <description>The latest articles on DEV Community by wasim15185 (@wasim15185).</description>
    <link>https://dev.to/wasim15185</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F481339%2F0052b2c0-3d45-45d7-b75b-57353442c908.png</url>
      <title>DEV Community: wasim15185</title>
      <link>https://dev.to/wasim15185</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wasim15185"/>
    <language>en</language>
    <item>
      <title> how to I to populate mongoose 'totalMsg' inside 'msg' ...........</title>
      <dc:creator>wasim15185</dc:creator>
      <pubDate>Mon, 26 Oct 2020 16:54:58 +0000</pubDate>
      <link>https://dev.to/wasim15185/how-to-i-to-populate-mongoose-totalmsg-inside-msg-3njm</link>
      <guid>https://dev.to/wasim15185/how-to-i-to-populate-mongoose-totalmsg-inside-msg-3njm</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let userSchema = new mongoose.Schema({
    name: String,
    password: String,
    email: {
        type: String
    },
    username: String,
    friends: [ { type: mongoose.Types.ObjectId } ],
    totalMsg: [
        {
            id: { type: mongoose.Types.ObjectId, ref: 'user' },
            msg: [ { type: mongoose.Types.ObjectId, ref: 'message' } ]
        }
    ]
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>mongodb</category>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>GIVE A SOLUTION of 'POPULATION ' of nested populate in mongoose  plzzz</title>
      <dc:creator>wasim15185</dc:creator>
      <pubDate>Mon, 26 Oct 2020 09:09:05 +0000</pubDate>
      <link>https://dev.to/wasim15185/give-a-solution-of-population-of-nested-populate-in-mongoose-closed-4hi</link>
      <guid>https://dev.to/wasim15185/give-a-solution-of-population-of-nested-populate-in-mongoose-closed-4hi</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;h1&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pTF_nE4a--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
            &lt;a href="https://stackoverflow.com/questions/64520447/give-a-solution-of-population-of-nested-populate-in-mongoose" rel="noopener noreferrer"&gt;
               GIVE A SOLUTION of 'POPULATION ' of nested populate in mongoose
            &lt;/a&gt;
        &lt;/h1&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Oct 25 '20&lt;/span&gt;
            &lt;span&gt;Comments: 4&lt;/span&gt;
            &lt;span&gt;Answers: 0&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/64520447/give-a-solution-of-population-of-nested-populate-in-mongoose" rel="noopener noreferrer"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5MiFESHx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          0
        &lt;/div&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rk_a5QFN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;&lt;strong&gt;when i requesting "/message/:id" that path then is gives me nested object which given below instead of showing  object id of 'msg'
i want to poulated 'totalMsg&amp;gt;msg ' and 'totalMsg&amp;gt; _id' but the population is not working&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;the nested object is showing interminal&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;&lt;code&gt;{   friends: [ 5f93b5c1a666a93698e67818, 5f9310e9eeab6507509710cf ]
_id:&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;…
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    
      &lt;a href="https://stackoverflow.com/questions/64520447/give-a-solution-of-population-of-nested-populate-in-mongoose" rel="noopener noreferrer"&gt;Open Full Question&lt;/a&gt;
    
  &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>please explain some conceptual part for express js and mongoose</title>
      <dc:creator>wasim15185</dc:creator>
      <pubDate>Sat, 03 Oct 2020 18:21:53 +0000</pubDate>
      <link>https://dev.to/wasim15185/some-conceptual-part-for-express-js-and-mongoose-3j53</link>
      <guid>https://dev.to/wasim15185/some-conceptual-part-for-express-js-and-mongoose-3j53</guid>
      <description>&lt;p&gt;##code is here &lt;br&gt;
if i &lt;strong&gt;'const homeModel = require('../models/home')'&lt;/strong&gt;; define indside &lt;strong&gt;'router.post'&lt;/strong&gt; then &lt;strong&gt;homeModel&lt;/strong&gt;is gives me &lt;strong&gt;whole home model&lt;/strong&gt; but when&lt;br&gt;
&lt;strong&gt;'const homeModel = require('../models/home');'&lt;/strong&gt; define in global then &lt;strong&gt;homeModel&lt;/strong&gt; gives a &lt;strong&gt;Empty Objects&lt;/strong&gt; / &lt;strong&gt;{}&lt;/strong&gt;   why it is happening like that&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             const router = require('express').Router();
          const userModel = require('../models/user');
         const commentModel = require('../models/comment');

     //importing middleware
     const { AuthMiddleWare } = require('../middleware/middleware');

 router.post('/comment/:id', AuthMiddleWare, (req, res) =&amp;gt; {
// important
const homeModel = require('../models/home'); **&amp;lt;--talking about this** 

const postId = req.params.id;
// console.log(postId);
const { comment } = req.body;
console.log(homeModel);
console.log(userModel);
console.log(commentModel);

homeModel.findById(postId, (err, post) =&amp;gt; {
    if (err) {
        console.log(err);
    } else {
        //finding Current  user
        userModel.findOne({ email: req.session.passport.user }, (err, user) =&amp;gt; {
            if (err) {
                console.log(err);
            } else {
                //founded Current user

                // post

                // create}
                              })
                       })
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

</description>
      <category>mongodb</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
