Questions tagged [embedded-documents]
95 questions
0
votes
1 answer
PHP: MongoDB projection on embedded document array with positional operator
I want to retrieve a specific array from embedded document on matching base but either the output is displaying all arrays in that document not a specific one or displaying just the first array....
this is my code please have a look and answer this…

Iram Chauhdri
- 3
- 3
0
votes
3 answers
Return Array from Embedded document
I have a data like in mongodb collection name property.
{
"_id": "593a3d828e2ef100d1496e77",
"feature_type": "house",
"features": [
{
"name": "h1"
},
…

manoj
- 5,235
- 7
- 24
- 45
0
votes
0 answers
AND operator in MongoDb Not retrieving proper data when Querying with ObjectId
I'm trying to retrieve documents which can satisfy all the conditions in this query from a embedded document in an array.It's retrieving documents of any of the condition satisfied.
db.getCollection('CollectionName').find(
{ $and: [{…

Rishi
- 7
- 4
0
votes
3 answers
Delete item from 2nd level embedded document
I have a collection of users, which have locations, which have some api keys.
{
"_id" : ObjectId("5864d5e2962d747913577cc1"),
"username" : "george",
"usernameCanonical" : "george",
"email" : "george.something@gmail.com",
…

George Ploscaru
- 53
- 1
- 4
0
votes
1 answer
How to add additional fields to embedded documents without changing the original model
I want to add extra properties to a document before embedding that into other document, but I don't know how to do that.
Here's my code and what I have tried so far:
from mongoengine import *
from datetime import datetime
class User(Document):
…

Rohit Khatri
- 1,980
- 3
- 25
- 45
0
votes
1 answer
Error executing a mongodb query with cursor.min with embedded documents
In my collection there are documents like this
{ "_id" : 112, "name" : "Myrtle Wolfinger", "scores" : [ { "type" : "exam", "score" : 73.93895528856032 }, { "type" : "quiz", "score" : 35.99397009906073 }, { "type" : "homework", "score" :…

provola
- 342
- 1
- 3
- 15
0
votes
2 answers
Searching for a value in an array using PHP
I have a list of users in my mongodb database, which can then follow each other -pretty standard. Using php I want to check if a specific user is following another user. My data looks like this.
array (
'_id' =>…

Joe
- 31
- 5
0
votes
1 answer
MongoDB - extract embedded document with query
I have a collection with documents like the following:
{
name: "Johann",
surname: "Esburg",
jobs: [
{
"profession": "chef",
"salary": 1000
}, {
"profession": "gardener",
"salary":…

tano
- 836
- 1
- 10
- 25
0
votes
1 answer
MongoDB Schema Redesign with existing data
I have around 200 000 Object names and 20 roles and 500 users.
Roles are categorized as admin,domain1,domain2,domain3,domain4..domain 20
Some roles (domain1,domain4 ) can only access to 5 object names and some other roles have access to 500-20…

Root
- 147
- 5
- 12
0
votes
1 answer
Updating a multilevel embedded document in MongoDB
I am trying to update a multilevel embedded document in MongoDB using dot notation and the $ operator. Below, I have a collection composed of one document:
{
"_id" : ObjectId("55da48520549875d8480707c"),
"queried" : [],
"field" : "materials…

Christian Lau
- 41
- 1
- 5
0
votes
0 answers
mongodb mongoengine filter document on nexted EmbeddedDocumentLIst fields
I have a document with a EmbeddedDocumentList inside an other EmbeddedDocumentlist, I need to filter the collections retrieving only the documents that have a specified value for a field inside the inner EmbeddedDocumentList
the reduced version of…

JcBobo
- 63
- 7
0
votes
1 answer
Mongoid HABTM relationships across embedded documents
I'm trying to create a Mongoid N-N reference association between two embedded documents in Rails 4 however I'm finding it difficult to get my head round how this is done.
I started by adding the HABTM association to the relevant models below (Track…

zenvelope
- 1,274
- 2
- 9
- 13
0
votes
1 answer
How to update array of embedded collection field based on another collection embedded field value in MongoDB?
I've searched in this forum for my below issue and I'm not able to find solution.
Inventory collction:
{
"_id" : ObjectId("555b1978af015394d1016374"),
"Billno" : "ABC1",
"Device_id" : "strsdedgfrtg12",
"item" : [
{
"item_id" : 232,
…

Root
- 147
- 5
- 12
0
votes
2 answers
$elemMatch on embedded documents
Here is what I am working with:
{
"_id": ObjectId("53b4402ae1382335c95952d3"),
"created": ISODate("2014-07-02T10:23:54.245Z"),
"modified": ISODate("2011-11-28T10:06:25.186Z"),
"source": [{
"instances": [{
…

user2012481
- 9
- 4
0
votes
1 answer
Update a complex schema with sub embed document
i m trying to update a sub embed document with mongodb, but does not work.
I want for a chapter.id & quest.id given, update the percent of this document (only this one)
My schema looks like :
{
"_id" : ObjectId("54ae5e63e71cef26050fca9a"),
…

MouradK
- 1,527
- 1
- 11
- 14