首页
\
问答
\
C#+ MongoDB - ObjectId,不使用MongoDB数据类型/属性(C# + MongoDB - ObjectId without using MongoDB DataTypes/Attributes)
C#+ MongoDB - ObjectId,不使用MongoDB数据类型/属性(C# + MongoDB - ObjectId without using MongoDB DataTypes/Attributes)
使用MongoDB作为我的数据存储使我有DefaultID作为主键的ObjectID类型。 它也可以通过使用带[BsonId]属性的Guid进行更改。 它也在MongoDB C#Driver库中定义。 我想让我的实体独立于数据层。 我可以使用名称标识作为属性来识别主键吗? 我还能尝试什么?
Using MongoDB as my data store makes me to have ObjectID type as primary key by Default. It also can be changed by using Guid with [BsonId] attribute. Which is also defined in MongoDB C# Driver library. I would like to have my Entities independent from Data layer. Can I just use name Id for the property to identify primary key? What else I can try?
原文:https://stackoverflow.com/questions/34796735
更新时间:2024-04-01 21:04
最满意答案
使用
dict(itertools.izip_longest(l, x)) # {1: 'a', 2: 'b', 3: 'c', 4: None, 5: None}
Use
dict(itertools.izip_longest(l, x)) # {1: 'a', 2: 'b', 3: 'c', 4: None, 5: None}
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
“Iterables”和“Iterators”有什么区别?(What is the difference between “Iterables” and “Iterators”?)[2022-02-28]
查看维基 : 因此,可以在Iterables找到您可能希望看到的所有集合支持的许多操作。 此外,大多数Iterables方法在Iterators中都有相应的版本,它接受原始迭代器。 Iterables许多方法都会调用Iterators的核心引导方法。 p代码: Iterables.operation(Iterables it){ if(it is-a Collection) return it.operation(); else return Iterators.operation( ... -
在字符串python iterables和list iterables中搜索(searching within string python iterables vs list iterables)[2023-11-14]
当你这样做: 2,2,2,2 in range(20) Python以这种方式看待它: 2,2,2,(2 in range(20)) 您希望以这种方式对待它: (2,2,2,2) in range(20) 但是由于Python不是面向矢量的,所以它并不像那样工作。 如果您更喜欢使用向量进行编程,NumPy更合适,但对于基本的Python比较,它并不像您想象的那样工作。 至于这个: "tab" in "batman" 当然它返回false,因为字符串"tab"不在字符串"batman" 。 这是一个字 ... -
final Iterator it = vals.iterator(); expected = Iterables.transform(keys, new Function
() { public Pair apply(String key) { return new Pair(key, it.next()); } }); 由AH添加: 在Xtend中,这看起来像这样: val valsIter = vals.iterator() val pair ... -
Python - 从其他两个词典的键创建一个字典(Python - Create a dictionary from the keys of two other dictionaries)[2023-02-02]
现在,您的数据看起来像元组列表,而不是字典。 在有效的python语法中,这将是: list_a = [('a', 0.55), (' ', 0.088), ('o', 0.088), ('>', 0.055), ('4', 0.055)] list_b = [('c', 0.021), ('h', 0.031), ('u', 0.031), ('8', 0.024), ('y', 0.054)] 然后可以创建一个字典,其中包含list_a ... -
从你的观点开始: D = {u'0HmZNYSfb2': [u'1TkTcV', u'1T8eDK', u'1T2fP4'], u'0HYrcjO26wS': [], u'0HsGjvej6U': [u'1TzoWb', u'1TbQQl'], u'0HsYF0oEuQ': [u'1Tgcdf'], u'0Ht2wIpTTc': [] } df = pd.DataFrame.from_dict(D, orient="index") 这对我来说产生以下df : ...
-
使用 dict(itertools.izip_longest(l, x)) # {1: 'a', 2: 'b', 3: 'c', 4: None, 5: None} Use dict(itertools.izip_longest(l, x)) # {1: 'a', 2: 'b', 3: 'c', 4: None, 5: None}
-
您可以使用Java实现自己的JSP标签,以便您可以编写接受Iterable的标签,然后以与使用JSTL forEach标签相同的方式使用该标签。 本文档举例说明了如何创建一个自定义标记来遍历任意自定义对象 - 您的实现可能会更简单。 关键在于返回EVAL_BODY_AGAIN以允许您多次处理标签的主体。 http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPTags6.html#68297 我还没有尝试过运行这个,但它可能是一开始: public class It ...
-
在Scala中合并两个迭代(Merging two iterables in Scala)[2023-07-31]
让我们从你的代码无效的原因开始吧。 首先,您不小心使用缩写语法作为存在类型 ,而不是实际使用绑定在较高kinded类型上的类型。 // What you wrote is equivalent to this def merge[A <: Iterable[T] forSome {type T}](first: A, second: A): A 即使修复它也不能完全找到你想要的东西。 def merge[A, S[T] <: Iterable[T]](first: S[A], second: S[A]): ...