Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
array içine insert
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Serdar B.  
View profile   Translate to Translated (View Original)
 More options Dec 2 2011, 5:33 am
From: "Serdar B." <hserd...@gmail.com>
Date: Fri, 2 Dec 2011 12:33:58 +0200
Local: Fri, Dec 2 2011 5:33 am
Subject: array içine insert

Merhaba,

MyCollection.Insert yada MyCollection.Save ile Array içine Item eklemeyi
bir türlü başaramadım...

şöyle bir şema hayal ediyorum.

_id
MyItems
   MyItem
       MyItemId
       MyItemName
   MyItem
       MyItemId
       MyItemName

Bu şemaya yeni MyItem ekleme kodunu bir türlü yazamadım...
Yardımcı olabilecek var mı?

c# ile yazıyorum.

MyCollection.Save(new BsonDocument {
                       { "_id", MyObjetcs.Id },
                       { "MyItems", new BsonArray {
                           new BsonDocument {{ "MyItemId", x.Id }},
                           new BsonDocument {{ "MyItemName", x.Name }}
                       }}});

şu nu yazdığımda istediğim gibi bir insert olmuyor...,

Query oluşturup update denedim oda olmadı...

var query = Query.And(Query.EQ("_id", MyObjects.Id),

Query.EQ("MyItems.MyItem.MyItemId", x.Id));

Nereleri yanlış düşünüyorum...

Serdar
--
serdarb.com <http://www.serdarb.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Veysel Taşçıoğlu  
View profile   Translate to Translated (View Original)
 More options Dec 2 2011, 6:41 am
From: Veysel Taşçıoğlu <veysel.tascio...@gmail.com>
Date: Fri, 2 Dec 2011 13:41:23 +0200
Local: Fri, Dec 2 2011 6:41 am
Subject: Re: array içine insert

Serdar merhaba;

_id
List<MyItem> myItems

İşini görecektir diye düşünüyorum.

Kolay gelsin.

2011/12/2 Serdar B. <hserd...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Serdar B.  
View profile   Translate to Translated (View Original)
 More options Dec 2 2011, 7:08 am
From: "Serdar B." <hserd...@gmail.com>
Date: Fri, 2 Dec 2011 14:08:29 +0200
Local: Fri, Dec 2 2011 7:08 am
Subject: Re: array içine insert

Merhaba,

Nesne zaten List içinde... ToBson() yapmadı o şekilde belki ben bişeyi
gözden kaçırıyorum...

Stackoverflow'da şöyle bir yönlendirme geldi.

MyCollection.Update(Query.EQ("_id", MyObject.Id),
                    Update.PushWrapped("MyArray", myArrayField)

http://stackoverflow.com/questions/8354291/how-can-i-update-mongodb-d...

Oluyomuş gibi yapıyo ama _id'yi sona atıyo update sonrası... doğru
yaptığıma emin olamadım o yüzden...

Serdar
--
serdarb.com <http://www.serdarb.com>

2011/12/2 Veysel Taşçıoğlu <veysel.tascio...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Veysel Taşçıoğlu  
View profile   Translate to Translated (View Original)
 More options Dec 2 2011, 7:10 am
From: Veysel Taşçıoğlu <veysel.tascio...@gmail.com>
Date: Fri, 2 Dec 2011 14:10:48 +0200
Local: Fri, Dec 2 2011 7:10 am
Subject: Re: array içine insert

"_id yi sona atıyor" derken?

2011/12/2 Serdar B. <hserd...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Serdar B.  
View profile   Translate to Translated (View Original)
 More options Dec 2 2011, 7:15 am
From: "Serdar B." <hserd...@gmail.com>
Date: Fri, 2 Dec 2011 14:15:15 +0200
Local: Fri, Dec 2 2011 7:15 am
Subject: Re: array içine insert

ilk insertteki find sorgusu

{"_id" : "1" , "MyItems" ...... } iken

update sonrası

{ .... , "_id" :"1" } oluyor...

obsesif birine yapılcak şey değil yani :)

Serdar
--
serdarb.com <http://www.serdarb.com>

2011/12/2 Veysel Taşçıoğlu <veysel.tascio...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Veysel Taşçıoğlu  
View profile   Translate to Translated (View Original)
 More options Dec 2 2011, 7:17 am
From: Veysel Taşçıoğlu <veysel.tascio...@gmail.com>
Date: Fri, 2 Dec 2011 14:17:29 +0200
Local: Fri, Dec 2 2011 7:17 am
Subject: Re: array içine insert

_id nin yeri önemli değil, önemli olan insert edip, update edip vs.. sonra
deserialize ederken veride bir sıkıntı olmaması.

2011/12/2 Serdar B. <hserd...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hasan Tayyar BESIK  
View profile  
 More options Dec 2 2011, 7:22 am
From: Hasan Tayyar BESIK <sacrosancttay...@gmail.com>
Date: Fri, 2 Dec 2011 14:22:42 +0200
Local: Fri, Dec 2 2011 7:22 am
Subject: Re: array içine insert

Serdar; evet konumu öndemli değil. Aslında field konumlarının önemli olduğu
bir veritabanı var mı bimliyorum.
Ayrıca
http://www.mongodb.org/display/DOCS/Updating#Updating-Field%28re%29order
dan alıntı yaparak konuna bir açıklama getirebilirim :
 Field (re)order

During an update the field order may be changed. There is no guarantee that
the field order will be consistent, or the same, after an update. At the
moment, if the update can be applied in place then the order will be the
same (with additions applied at the end), but if a move is required for the
document (if the currently allocated space is not sufficient for the
update) then the fields will be reordered (alphanumerically).

Hasan Tayyar BEŞİK
http://hasantayyar.com
http://twitter.com/htayyar

Please don't print this e-mail unless you really need to.

2011/12/2 Veysel Taşçıoğlu <veysel.tascio...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Serdar B.  
View profile  
 More options Dec 2 2011, 7:25 am
From: "Serdar B." <hserd...@gmail.com>
Date: Fri, 2 Dec 2011 14:25:20 +0200
Local: Fri, Dec 2 2011 7:25 am
Subject: Re: array içine insert

Teşekkürler,

içime su serpildi :)

Serdar
--
serdarb.com <http://www.serdarb.com>

On Fri, Dec 2, 2011 at 2:22 PM, Hasan Tayyar BESIK <


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Veysel Taşçıoğlu  
View profile   Translate to Translated (View Original)
 More options Dec 2 2011, 7:27 am
From: Veysel Taşçıoğlu <veysel.tascio...@gmail.com>
Date: Fri, 2 Dec 2011 14:27:09 +0200
Local: Fri, Dec 2 2011 7:27 am
Subject: Re: array içine insert

Yanlış hatırlamıyorsam (c# driverında) custom mapping yazılırsa sırası
belirlenebiliyordu.
Ayrıca örneğin değişkenin ismi çok uzun ve "My...........List" gibi birşey
diyelim. Bunu mapping ile store edilrken ismini örneğin "abc" diye
değiştirebiliyoruz.

2011/12/2 Serdar B. <hserd...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Serdar B.  
View profile  
 More options Dec 2 2011, 7:31 am
From: "Serdar B." <hserd...@gmail.com>
Date: Fri, 2 Dec 2011 14:31:54 +0200
Local: Fri, Dec 2 2011 7:31 am
Subject: Re: array içine insert

Evet varmış öyle bir attribute..

public class MyClass {
    [BsonElement("sp", Order = 1)]
    public string SomeProperty { get; set; }

}

Ben sürekli serialize/deseriliaze olmasın diye

new BsonDocument deyip kendim map edeyim dedim...

ikisinin arasında bir fark yok diyebilir miyiz? orda da mı obsesif
davranıyorum acaba...

Serdar
--
serdarb.com <http://www.serdarb.com>

2011/12/2 Veysel Taşçıoğlu <veysel.tascio...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Veysel Taşçıoğlu  
View profile   Translate to Translated (View Original)
 More options Dec 2 2011, 7:34 am
From: Veysel Taşçıoğlu <veysel.tascio...@gmail.com>
Date: Fri, 2 Dec 2011 14:34:31 +0200
Local: Fri, Dec 2 2011 7:34 am
Subject: Re: array içine insert

Attribute değil de, mapping kullanırsan daha iyi olur diye düşünüyorum.

2011/12/2 Serdar B. <hserd...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »