search question

I have a collection, “startCollection,” with one document, within which there are embedded documents, like this:

[lua]

{

_id: ObjectId(“56bbd564c0523ba4ddd45d2b”),

objectId: “39a9ae5373”,

markerTable: [

null,

{ startId: “1f59fcbf7e8”, com: “If you really want.”, sliceId: “6ca4d394ae1” },

{ startId: “5c3d06bd8b”, com: “Which produces stone.”, sliceId: “6ca4d394ae2” }

]

}

[/lua]

You proposed a coronium.user.getUsers query for a similarly structured User collection which did work. It looked like this:

[lua]

 local answer = coronium.mongo:getObjects( “startCollection”,

     {

         markerTable = 

         { 

            ["$elemMatch"] =   {sliceId = “6ca4d394ae1”}

         }

     }

 )

[/lua]

but it does not work here. One difference, obviously, is that with user.getUsers I did not have to specify the collection name (“startCollection” in this case). Do I have that part structured wrong?

Do you have any thought on how to query this collection and find on object in the markerTable by sliceId?

Thanks!

Hi,

I’ll see what I can figure out, the User database is a “system” collection, so it’s handled behind the scenes.

But, it still should operate the same. Have you tried doing:

[lua]

{ [“sliceId”] = … }

[/lua]

Let me know.

Cheers.

No luck - it seems as though it is returning the entire “startCollection”

Hey Chris, so, digging into mongo docs seems to confirm both that the entire collection IS being returned, and that that’s just the way mongo works when querying against embedded documents. I would very much like to discover that I have misunderstood. Please tell me I have :) 

Hi Kevin,

I believe that refers to what takes place on the server side, in-memory (correct me if I’m mistaken). You’re not piping down all the documents into your Corona project, unless you specifically requested all the documents to be output to the client. In any event the server has much more to work with resource-wise, only under extreme circumstances should you have any problems.

I got started working with your query question yesterday, but unfortunately, having a bout of Flu, so things are slow. But from first indications, it seems to be a version issues, which is odd. On the command line, while in the server, are you able to run:

[lua]sudo mongo -v[/lua]

And let me know the results. Thanks.

Cheers.

Hey Chris, had no results with mongo -v but got some something using mongod -v so hope this is what you are looking for:

root@install:~# mongod -v

2016-03-12T19:30:02.194-0500 [DataFileSync] BackgroundJob starting: DataFileSync

2016-03-12T19:30:02.195-0500 shardKeyTest passed

2016-03-12T19:30:02.196-0500 isInRangeTest passed

2016-03-12T19:30:02.196-0500 shardObjTest passed

2016-03-12T19:30:02.196-0500 [initandlisten] MongoDB starting : pid=28711 port=27017 dbpath=/data/db 64-bit host=install.coronium.humble-pie

2016-03-12T19:30:02.197-0500 [initandlisten] db version v2.6.11

2016-03-12T19:30:02.197-0500 [initandlisten] git version: d00c1735675c457f75a12d530bee85421f0c5548

2016-03-12T19:30:02.197-0500 [initandlisten] build info: Linux build4.ny.cbi.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49

2016-03-12T19:30:02.198-0500 [initandlisten] allocator: tcmalloc

2016-03-12T19:30:02.198-0500 [initandlisten] options: { systemLog: { verbosity: 1 } }

2016-03-12T19:30:02.198-0500 [initandlisten] User Assertion: 10296:

*********************************************************************

 ERROR: dbpath (/data/db) does not exist.

 Create this directory or give existing directory in --dbpath.

 See http://dochub.mongodb.org/core/startingandstoppingmongo

*********************************************************************

 

2016-03-12T19:30:02.199-0500 [initandlisten] exception in initAndListen: 10296 

*********************************************************************

 ERROR: dbpath (/data/db) does not exist.

 Create this directory or give existing directory in --dbpath.

 See http://dochub.mongodb.org/core/startingandstoppingmongo

*********************************************************************

, terminating

2016-03-12T19:30:02.200-0500 [initandlisten] dbexit: 

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: going to close listening sockets…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: going to flush diaglog…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: going to close sockets…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: waiting for fs preallocator…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: lock for final commit…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: final commit…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: closing all files…

2016-03-12T19:30:02.200-0500 [initandlisten] closeAllFiles() finished

2016-03-12T19:30:02.200-0500 [initandlisten] dbexit: really exiting now

Hi,

I’ll see what I can figure out, the User database is a “system” collection, so it’s handled behind the scenes.

But, it still should operate the same. Have you tried doing:

[lua]

{ [“sliceId”] = … }

[/lua]

Let me know.

Cheers.

No luck - it seems as though it is returning the entire “startCollection”

Hey Chris, so, digging into mongo docs seems to confirm both that the entire collection IS being returned, and that that’s just the way mongo works when querying against embedded documents. I would very much like to discover that I have misunderstood. Please tell me I have :) 

Hi Kevin,

I believe that refers to what takes place on the server side, in-memory (correct me if I’m mistaken). You’re not piping down all the documents into your Corona project, unless you specifically requested all the documents to be output to the client. In any event the server has much more to work with resource-wise, only under extreme circumstances should you have any problems.

I got started working with your query question yesterday, but unfortunately, having a bout of Flu, so things are slow. But from first indications, it seems to be a version issues, which is odd. On the command line, while in the server, are you able to run:

[lua]sudo mongo -v[/lua]

And let me know the results. Thanks.

Cheers.

Hey Chris, had no results with mongo -v but got some something using mongod -v so hope this is what you are looking for:

root@install:~# mongod -v

2016-03-12T19:30:02.194-0500 [DataFileSync] BackgroundJob starting: DataFileSync

2016-03-12T19:30:02.195-0500 shardKeyTest passed

2016-03-12T19:30:02.196-0500 isInRangeTest passed

2016-03-12T19:30:02.196-0500 shardObjTest passed

2016-03-12T19:30:02.196-0500 [initandlisten] MongoDB starting : pid=28711 port=27017 dbpath=/data/db 64-bit host=install.coronium.humble-pie

2016-03-12T19:30:02.197-0500 [initandlisten] db version v2.6.11

2016-03-12T19:30:02.197-0500 [initandlisten] git version: d00c1735675c457f75a12d530bee85421f0c5548

2016-03-12T19:30:02.197-0500 [initandlisten] build info: Linux build4.ny.cbi.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49

2016-03-12T19:30:02.198-0500 [initandlisten] allocator: tcmalloc

2016-03-12T19:30:02.198-0500 [initandlisten] options: { systemLog: { verbosity: 1 } }

2016-03-12T19:30:02.198-0500 [initandlisten] User Assertion: 10296:

*********************************************************************

 ERROR: dbpath (/data/db) does not exist.

 Create this directory or give existing directory in --dbpath.

 See http://dochub.mongodb.org/core/startingandstoppingmongo

*********************************************************************

 

2016-03-12T19:30:02.199-0500 [initandlisten] exception in initAndListen: 10296 

*********************************************************************

 ERROR: dbpath (/data/db) does not exist.

 Create this directory or give existing directory in --dbpath.

 See http://dochub.mongodb.org/core/startingandstoppingmongo

*********************************************************************

, terminating

2016-03-12T19:30:02.200-0500 [initandlisten] dbexit: 

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: going to close listening sockets…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: going to flush diaglog…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: going to close sockets…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: waiting for fs preallocator…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: lock for final commit…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: final commit…

2016-03-12T19:30:02.200-0500 [initandlisten] shutdown: closing all files…

2016-03-12T19:30:02.200-0500 [initandlisten] closeAllFiles() finished

2016-03-12T19:30:02.200-0500 [initandlisten] dbexit: really exiting now