Rehinkdb,在更改后得到行号()

时间:2016-05-27 15:50:47

标签: javascript rethinkdb rethinkdb-javascript

我是Rethinkdb和ReQL api的新手。我想知道在insert()之后获取表的count()的最佳方法是什么?

这是我实际的javascript实现,但我认为可以改进

Private Function GetAllSyncedContactIdsInExchange(pService As ExchangeService) As List(Of Integer) Dim oInternalContactIdDefinition As New ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, conContactIdPropertyName, MapiPropertyType.Integer) Dim oInternalContactIdFilter As New SearchFilter.Exists(oInternalContactIdDefinition) Dim oResults As FindItemsResults(Of Item) = Nothing Dim oPropertySet As New PropertySet(oInternalContactIdDefinition) Dim lstSyncedContactIds As New List(Of Integer) Dim intDBId As Integer Dim lstEESContactFolders As List(Of FolderId) = GetAllCustomEESFolderIds(pService) For Each oFolderId As FolderId In lstEESContactFolders Dim blnMoreAvailable As Boolean = True Dim intSearchOffset As Integer = 0 Dim oView As New ItemView(conMaxChangesReturned, intSearchOffset, OffsetBasePoint.Beginning) oView.PropertySet = BasePropertySet.IdOnly Do While blnMoreAvailable oResults = pService.FindItems(oFolderId, oInternalContactIdFilter, oView) blnMoreAvailable = oResults.MoreAvailable If Not IsNothing(oResults) AndAlso oResults.Items.Count > 0 Then pService.LoadPropertiesForItems(oResults, oPropertySet) For Each oExchangeItem As Item In oResults.Items If oExchangeItem.TryGetProperty(oInternalContactIdDefinition, intDB2Id) Then lstSyncedContactIds.Add(intDBId) End If Next If blnMoreAvailable Then oView.Offset = oView.Offset + conMaxChangesReturned End If Loop Next Return lstSyncedContactIds End Function

然后我添加新行

r.table('likes') .changes() .run(conn) .then(cursor => cursor.each(() => { r.table('likes') .count() .run(conn, (err, result) => console.log(result)) }) })

感谢您的帮助!

0 个答案:

没有答案