PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Sunday the 31st of July, 2016

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:35:49] <teprrr> tom: is there some kind of bulk update api in mongo?
[01:03:13] <StephenLynx> teprrr, bulkwrite
[06:05:01] <EtherNet> hello everyone, good night
[06:05:06] <EtherNet> is anyone awake? I've got a quick question
[06:07:23] <EtherNet> I am working with php and I need to get the amount (count) of items in a collection. I mean the same result I get running db.count() on the shell, I need to execute it through php and I can't find the way
[17:13:15] <kenalex> hello
[17:23:31] <akagetsu01> hi
[18:00:12] <kenalex> I am creating a system that will have vouchers that can be redeemed by users. the vouchers are divided in batches. SO there is a one to many relationship between VoucherBatch and Vouchers. What is the best way to implement this ? is the embedded format best where a list of vouchers are embedded in a batch ?
[18:02:38] <StephenLynx> hm
[18:02:44] <StephenLynx> you could have a list of ids on either one.
[18:03:14] <StephenLynx> how much data each contains?
[18:06:02] <kenalex> I can have around 100,000 vouchers per batch
[18:06:38] <StephenLynx> no
[18:06:55] <StephenLynx> how much data each voucher contains?
[18:07:08] <StephenLynx> and how much data each batch contains?
[18:07:12] <StephenLynx> excluding the relation.
[18:10:22] <kenalex> here is an example of a voucher document
[18:10:25] <kenalex> {
[18:10:25] <kenalex> "VoucherNumber" : "NOPKCYKBXO5WDZEE39MC",
[18:10:25] <kenalex> "SerialNumber" : 60002,
[18:10:25] <kenalex> "VoucherState" : "Available",
[18:10:25] <kenalex> "IsUsed" : false,
[18:10:26] <kenalex> "MacAddress" : "AAE4561278E3",
[18:10:28] <kenalex> "UpdateDate" : ISODate("2016-07-31T17:59:55.167Z")
[18:10:32] <kenalex> },
[18:10:42] <StephenLynx> and the batch?
[18:12:01] <kenalex> batch document
[18:12:03] <kenalex> {
[18:12:03] <kenalex> "_id" : ObjectId("579e3c9b5a0d2a151882dfe5"),
[18:12:03] <kenalex> "Name" : "Test vouchers",
[18:12:03] <kenalex> "CreateDate":ISODate("2016-07-31T17:59:55.167Z"),
[18:12:03] <kenalex> "State":"Available"
[18:12:04] <kenalex> }
[18:12:33] <StephenLynx> any reason you have vouchernumber instead of using the _id?
[18:13:20] <kenalex> no. that document is a test I was doing testing it as a sub document inside of Batch. it can made to be _id
[18:13:33] <StephenLynx> anyway, you don`t want to duplicate the whole documents. i`d keep them on separate collections and have an array containing the ids of related documents.
[18:13:43] <StephenLynx> then, duplicate batch or voucher ids?
[18:13:48] <StephenLynx> that depends on how you are going to query it.
[18:15:56] <kenalex> so i could either have an array of voucher ids in Batch or assign a batchId field in each individual voucher ?
[18:16:27] <StephenLynx> you said you`d have n-n
[18:16:38] <StephenLynx> if you assign a single batch id to the voucher, its 1-n
[18:16:54] <StephenLynx> aah
[18:16:55] <kenalex> 1 to n relationship
[18:16:58] <StephenLynx> I misread.
[18:17:01] <StephenLynx> indeed, 1-n
[18:17:10] <StephenLynx> forget the array then.
[18:17:17] <kenalex> one batch and may vouchers in the batch
[18:17:21] <StephenLynx> i`d have the batch id as a field on the voucher.
[18:17:57] <kenalex> ok thanks StephenLynx
[18:18:26] <kenalex> my second project using mongodb :)
[19:53:28] <tom> teprrr: there's a bulk api, but it doesn't seem to support findAndModify, which is what I'm looking for