subdocument Questions

8

Solved

If you have subdocument arrays, Mongoose automatically creates ids for each one. Example: { _id: "mainId" subDocArray: [ { _id: "unwantedId", field: "value" }, { _id: "unwantedId", field:...
Soinski asked 22/6, 2013 at 18:28

3

Solved

I created this schema with mongoose Schema : socialAccount = new Schema({ socialNetwork : { type : String , required : true}, userid : { type : Number, required : true }, username : String },{...
Turbary asked 24/9, 2015 at 6:21

3

Solved

I'm moving my app from express.js to Nest.js, and I can't find a way to reference one mongoose Schema in another, without using old way of declaring Schema with mongoose.Schema({...}). Let's use ex...
Boron asked 2/7, 2020 at 20:31

2

Solved

Would it be possible for an ObjectId in ModelA to reference a sub-document in modelB? var C = new Schema({...}); var B = new Schema({c: [C]}); var A = new Schema({c: { type: ObjectId, ref: 'Mode...
Dower asked 20/7, 2014 at 18:6

2

I have a projects collection with documents such as this: { "_id" : ObjectId("589eff3fee3d13019843f55a"), "name" : "Project A", "desc" : "test", "numofvms" : 0, "templates" : [ { "_id" : Ob...
Density asked 11/2, 2017 at 12:44

1

Solved

I am working with a MongoDB database whose collections model classes, students, subjects, and [academic] performance. Below are the Mongoose based schema and models: var mongoose = require('mongoo...
Girasol asked 2/7, 2016 at 0:17

1

Solved

I have a document that looks like this: { "_id" : ObjectId("56fea43a571332cc97e06d9c"), "sections" : [ { "_id" : ObjectId("56fea43a571332cc97e06d9e"), "registered" : [ "123", "e3d65a4e-2552...
Wivern asked 12/4, 2016 at 16:40

2

Solved

I'm having a little trouble returning and displaying tags that I'm adding to a subdocument. I have no problem adding tags, but want to put a label on the item for each tag. I simply can't find a re...
Mezzo asked 14/1, 2015 at 19:43

1

I'm trying to get a specific field from a subdocument array I'm not gonna include any of the fields in the parent doc Here is the sample document { "_id" : ObjectId("5409dd36b71997726532012d"),...
Highball asked 5/9, 2014 at 16:44

1

Solved

I have the following document in the collection: "_id" : "2", "workspace" : [{ "name" : "1", "widgets" : [ ] },{ "name" : "2", "widgets" : [ ] },{ "name" : "3", "widgets" : [ ] },{ "name...
Chavaree asked 31/10, 2013 at 14:46
1

© 2022 - 2024 — McMap. All rights reserved.